A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/061616.html below:

[Python-Dev] PEP for Better Control of Nested Lexical Scopes

[Python-Dev] PEP for Better Control of Nested Lexical Scopes [Python-Dev] PEP for Better Control of Nested Lexical ScopesGeorg Brandl g.brandl at gmx.net
Tue Feb 21 17:13:12 CET 2006
Greg Ewing wrote:

>    def my_func():
>      namespace foo
>      foo.x = 42
> 
>      def inc_x():
>        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 my_func.

But why is that better than

class namespace(object): pass

def my_func():
    foo = namespace()
    (...)

?

Georg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4