[Python-Dev] PEP for Better Control of Nested Lexical Scopes (original) (raw)
Georg Brandl g.brandl at gmx.net
Tue Feb 21 17:13:12 CET 2006
- Previous message: [Python-Dev] PEP for Better Control of Nested Lexical Scopes
- Next message: [Python-Dev] PEP for Better Control of Nested Lexical Scopes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing wrote:
def myfunc(): namespace foo foo.x = 42
def incx(): foo.x += 1 The idea here is that foo wouldn't be an object in its own right, but just a collection of names that would be implemented as local variables of myfunc.
But why is that better than
class namespace(object): pass
def my_func(): foo = namespace() (...)
?
Georg
- Previous message: [Python-Dev] PEP for Better Control of Nested Lexical Scopes
- Next message: [Python-Dev] PEP for Better Control of Nested Lexical Scopes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]