"Martin v. Löwis" <[EMAIL PROTECTED]> 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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com