[Python-ideas] Modules could behave like new-style objects

Nick Coghlan ncoghlan at gmail.com
Fri Apr 3 00:19:52 CEST 2009


Zac Burns wrote:
> Thanks Aahz,
> 
> I did a search for previous threads but all the keywords and
> combinations of keywords I could think of showed an overwhelming
> amount of unrelated things. Does anyone know where I can find this
> information?

Here's an example thread:
http://mail.python.org/pipermail/python-dev/2003-January/032106.html

It would also pose some difficult technical questions - currently
"attr", "globals()['attr']" and "sys.modules[__name__].attr" all access
the same value in different ways. If descriptors are allowed on normal
modules, should the first two expressions be changed to invoke them? Or
will the 3 expressions no longer be alternate ways of saying the same thing?

Given the behaviour of code in the body of a class definition, it would
most likely be the latter, but it would take quite a bit of thought to
figure out the full ramifications of that.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list