|
|
Subscribe / Log in / New account

Pyjamas: writing AJAX applications in Python

Pyjamas: writing AJAX applications in Python

Posted Aug 26, 2009 21:14 UTC (Wed) by iabervon (subscriber, #722)
In reply to: Pyjamas: writing AJAX applications in Python by Cyberax
Parent article: Pyjamas: writing AJAX applications in Python

The scoping and line termination rules, combined with being interpreted at runtime, make a large portion of bugs difficult to detect without actually reaching every line of code.

Of course, Python has the same problem as Javascript here, but it's more than twice as bad if you're doing a project with both, because they not only both have error-encouraging scoping and line termination rules, they have different rules. So the Python you're writing encourages you to accidentally make your Javascript variables global and forget required semicolons.


to post comments

Pyjamas: writing AJAX applications in Python

Posted Aug 26, 2009 22:07 UTC (Wed) by drag (guest, #31333) [Link] (3 responses)

> because they not only both have error-encouraging scoping and line
termination rules,

What?

I don't understand. The line termination rules for python is very simple..
A line of code ends with a newline. The only exceptions that I can think
of to this is that you can explicitly end a line of code with ";" and you
can extend a mathematical statement by enclosing it in ().

This, to me, is a hell of a lot better then requiring ;'s all over the
place.
I tend to forget those time to time and it's sometimes very irritating to
track that down. In python as long as I keep my code clean and line
lengths to under 80 characters (or so) then it's easy to know what a line
of code is just by looking at it. A line of code is a line of text.

And what is error prone about Python's scoping? I can't imagine that its
any worse then C++ or C or Java or anything like that.

Pyjamas: writing AJAX applications in Python

Posted Aug 28, 2009 7:12 UTC (Fri) by niner (subscriber, #26151) [Link]

Open brackets or braces can extend an expression to multiple lines. And that is a very
good thing, otherwise it would make code quite unreadable. The ''' or """ quotes do the
same.

But both mean that you cannot simply trust a statement to be a single line of code.

Pyjamas: writing AJAX applications in Python

Posted Aug 30, 2009 13:18 UTC (Sun) by kleptog (subscriber, #1183) [Link]

Actually, python's scoping is one of my biggest problems. The fact that the scoping of a variable can change in odd ways. Consider:

import time

def main():
   print time.clock()

   time = 1

main()
This program produces an error on the "print" line, yet if you comment out the "time = 1" line it works. This means you have to read a whole function before you can determine the scope of a variable. Being someone who controls scopes carefully so that typos are more easily found, it all feels weird.

Pyjamas: writing AJAX applications in Python

Posted Sep 3, 2009 4:28 UTC (Thu) by tjc (guest, #137) [Link]

This, to me, is a hell of a lot better then requiring ;'s all over the place. I tend to forget those time to time and it's sometimes very irritating to track that down.
Semicolons are optional in Javascript, so why bother to "track that down?" If you don't like them, then just leave them off.

Pyjamas: writing AJAX applications in Python

Posted Aug 29, 2009 5:44 UTC (Sat) by SteveAdept (guest, #5061) [Link]

Add me to the list of people who don't like Javascript. My primary peeve is how it represents null values, similar to the mess PHP makes of it. If I never initialized a variable before I start reading from it, I want to know about it. Ick. I find that it often makes debugging extremely frustrating for me.

And I realize this isn't specifically a language issue, but I hate the fact that we have to deal with so many different implementations. I'm spoiled by the ubiquity and consistency of CPython, I guess.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds