19 Jan
2007
19 Jan
'07
11:55 p.m.
Josiah Carlson schrieb:
I was saying that it would be nice if the following were true:
>>> encodings.__module__ <module 'encodings' from 'C:\python25\lib\encodings\__init__.pyc'>
Ah, ok. It would be somewhat confusing, though, that __module__ is sometimes a module object, and sometimes a string (it certainly confused me).
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).
That remains to be seen in practice. Currently, modules are explicitly cleared at shutdown. I think any cycle with an object implementing __del__ will keep loads of modules alive, noncollectable for GC. Regards, Martin