[Python-ideas] Module local namespaces

Matt Draisey matt at draisey.ca
Thu Jan 4 03:25:16 CET 2007


On Wed, 2007-01-03 at 17:17 -0800, Josiah Carlson wrote:

> You can already do this with the following code:
> 
>     __gl = globals()
>     for name in __gl.keys():
>         if name[:1] == '_' and len(name) > 1 and name.count('_') == 1:
>             del __gl[name]
>     del __gl
> 
>  - Josiah

No, that is not what I meant.  I wasn't talking about deleting
temporaries but not publishing private objects.  Brett Cannon understood
when he said, "Private namespaces are not exactly a popular thing in
Python".  But functional programming style and generators are all the
rage and they often drag in private state via a closure.







More information about the Python-ideas mailing list