Puzzle: anonymous tuple unpacking w/o eval

Edward K. Ream edreamleo at charter.net
Fri May 16 10:41:34 EDT 2003


> > Is there a way to do something similar with locals() so as not to
> > affect the global namespace? The documentation sternly warns against
> > modifying locals().
>
> No, but the obvious thing to do is to modify a class object which keeps
> your extra names out of the global namespace:

Clever.  Thanks for suggesting this.

> That only works if the function name is also the name of a global
variable,
> which is rarely true if you are uses classes and methods.

This doesn't bother me.  self is an object from which all else can be
gleaned.

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  edreamleo at charter.net
Leo: Literate Editor with Outlines
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------






More information about the Python-list mailing list