[Python-ideas] Module local namespaces

Brett Cannon brett at python.org
Thu Jan 4 03:31:15 CET 2007


On 1/3/07, Matt Draisey <matt at draisey.ca> wrote:
>
> 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.


True, but you can still get at everything in either (generators, for
instance, expose the paused execution frame and gives you access to
everything).  But I consider these more of an exception instead of the
rule.  The only way I can see myself approving something like this is if it
helped with security (which it might, but I don't know if it would be the
best solution).

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20070103/358a8ffa/attachment.html>


More information about the Python-ideas mailing list