[Python-Dev] a strange case

Walter Dörwald walter@livinglogic.de
Mon, 19 May 2003 00:19:18 +0200


Guido van Rossum wrote:

>>"Why in the world would you want callable modules you ask?"  I 
>>don't have a real need, but I often see the line blurred between packag=
e, 
>>module, and class.
> 
> Please don't try to blur the line between module and class.  This has
> been proposed many times,

It sounds familiar! ;)

> and the net result IMO is always more
> confusion and no more power.  This is also why in 2.3, modules are no
> longer subclassable.
> 
> If you really need to have a module that has behavior beyond what a
> module can offer, the officially sanctioned way is to stick an
> instance of a class in sys.modules[__name__] from inside the module's
> code.

But reload() won't work for these pseudo modules (See
http://www.python.org/sf/701743). What about the imp module?

> (I would explain more about *why* I think it's a really bad idea, but
> I'm officially on vacation.)

Sure, this can wait.

Bye,
    Walter Dörwald