A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2007-January/070701.html below:

[Python-Dev] Problem between deallocation of modules and func_globals

[Python-Dev] Problem between deallocation of modules and func_globals [Python-Dev] Problem between deallocation of modules and func_globalsJosiah Carlson jcarlson at uci.edu
Fri Jan 19 21:09:48 CET 2007
"Martin v. Löwis" <martin at v.loewis.de> wrote:
> 
> Josiah Carlson schrieb:
> > Seems to me like a bug, but the bug could be fixed if the module's
> > dictionary kept a (circular) reference to the module object.  Who else
> > has been waiting for a __module__ attribute?
> 
> This is the time machine at work:
> 
> py> import encodings
> py> encodings.search_function.__module__
> 'encodings'
> 
> It's a string, rather than the module object, precisely to avoid cyclic
> references.

I was saying that it would be nice if the following were true:

    >>> encodings.__module__
    <module 'encodings' from 'C:\python25\lib\encodings\__init__.pyc'>

That would make it easier for functions inside a module to pass around
references to the module namespace (I've had the need to do so before,
and have ended up using sys.modules[__name__], but that doesn't always
work).

So what if it is a circular reference (module references dict which
references module), we've got a GC which handles cycles just fine (when
users try not to be too smart).

 - Josiah

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