private variables/methods

Alex Martelli aleaxit at yahoo.com
Sun Oct 12 18:42:12 EDT 2003


Sean Ross wrote:
   ...
> Hi.
> I'm not sure I'm clear on what behaviour "import __current_module__" is
> expected to have.

Just like any other import, it binds the name to a module object -- except
that it specifically binds said name to the module containing the function 
that executes this import statement.  The use case is: deprecating the
global statement.  Setting a global variable would instead use:
    import __current_module__
    __current_module__.thevariable = 23

So, your version does something very different from mine.


Alex





More information about the Python-list mailing list