LWN.net Logo

Pyjamas: writing AJAX applications in Python

Pyjamas: writing AJAX applications in Python

Posted Aug 26, 2009 22:07 UTC (Wed) by drag (subscriber, #31333)
In reply to: Pyjamas: writing AJAX applications in Python by iabervon
Parent article: Pyjamas: writing AJAX applications in Python

> 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.


(Log in to post comments)

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 (subscriber, #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.

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