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/2014-November/137277.html below:

[Python-Dev] advice needed: best approach to enabling "metamodules"?

[Python-Dev] advice needed: best approach to enabling "metamodules"? [Python-Dev] advice needed: best approach to enabling "metamodules"?Greg Ewing greg.ewing at canterbury.ac.nz
Sat Nov 29 22:36:45 CET 2014
Guido van Rossum wrote:
> Are these really all our options? All of them sound like hacks, none of 
> them sound like anything the language (or even the CPython 
> implementation) should sanction.

If assignment to the __class__ of a module were permitted
(by whatever means) then you could put this in a module:

    class __class__(types.ModuleType):
       ...

which makes it look almost like a deliberate language
feature. :-)

Seriously, of the options presented, I think that allowing
__class__ assignment is the most elegant, since it solves
a lot of problems in one go without introducing any new
features -- just removing a restriction that prevents an
existing language mechanism from working in this case.

-- 
Greg
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