[Python-ideas] Module __getattr__ [Was: breaking out of module execution]

Nick Coghlan ncoghlan at gmail.com
Tue May 1 04:48:02 CEST 2012


On Tue, May 1, 2012 at 12:33 PM, Guido van Rossum <guido at python.org> wrote:
> But all in all I don't think there's a great future in stock for the
> idea of allowing modules to be "subclassed". In the vast, vast
> majority of cases it's better to clearly have a separation between
> modules, which provide no inheritance and no instantiation, and
> classes, which provide both. I think Python is better off this way
> than Java, where all you have is classes (its packages cannot contain
> anything except class definitions).

FWIW, in 3.3 the full import machinery will be exposed in
sys.meta_path (and sys.path_hooks), so third parties will be free to
experiment with whatever crazy things they want without having to work
around the implicit import behaviour :)

Cheers,
Nick.

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



More information about the Python-ideas mailing list