On Fri, Dec 10, 2010 at 3:51 PM, John Nagle <na...@animats.com> wrote: > On 12/10/2010 3:25 PM, Stefan Behnel wrote: >> >> Benjamin Kaplan, 11.12.2010 00:13: >>> >>> On Fri, Dec 10, 2010 at 5:46 PM, Octavian Rasnita wrote: > >>> The only scopes Python has are module and function. > > There's more. Both a lambda, and in Python 3.x, > list comprehensions, introduce a new scope. > > John Nagle > -- > http://mail.python.org/mailman/listinfo/python-list >
And classes and methods. Also, I like to draw a distinction between "code scopes" and "data scopes". We've been talking about data scopes. Code scopes are pretty much indents and dedents in Python - they define what code is operated on by something code-flow-related. To the OP: Python doesn't need a "my" or "local" - it has more rational defaults. -- http://mail.python.org/mailman/listinfo/python-list