jfj wrote: > Max wrote: > > Yeah, I know. It's the price we pay for forsaking variable declarations. > > But for java programmers like me, Py's scoping is too complicated. > > Please explain what constitutes a block/namespace, and how to refer to > > variables outside of it. > > > Some may disagree, but for me the easiest way to understand python's > scopes is this: > > """In Python, there are only two scopes. The global and the local. > The global scope is a dictionary while the local, in the case of a > function is extremely fast. There are no other scopes.
This isn't true anymore, now that generator comprehensions have been added to the language. >>> x = 17 >>> sum(x for x in xrange(101)) 5050 >>> x 17 -- http://mail.python.org/mailman/listinfo/python-list