Modules with __getattr__ (Re: PEP 317: Eliminate Implicit Exc eption Instantiation)

sismex01 at hebmex.com sismex01 at hebmex.com
Wed Jun 11 09:49:58 EDT 2003


> From: Greg Ewing (using news.cis.dfn.de)
> [mailto:g2h5dqi002 at sneakemail.com]
> Sent: Tuesday, June 10, 2003 10:04 PM
> 
> By the way, the main use case I have for this is
> for implementing autoloading of classes, so that I
> can have a top-level package which apparently contains
> a bunch of classes, but they don't actually get created
> until someone asks for them. A module class with a
> __getattr__ would be ideal for this.
> 
> I can feel a PEP coming on...
>

Maybe it's not necessary; PMW already does something
like this, when you import a megawidget by:

>>> import PMW.xxxx

it searches the modules in the PMW package and imports
the latest version available.

hth.

-gca
Advertencia:La informacion contenida en este mensaje es confidencial y
restringida, por lo tanto esta destinada unicamente para el uso de la
persona arriba indicada, se le notifica que esta prohibida la difusion de
este mensaje. Si ha recibido este mensaje por error, o si hay problemas en
la transmision, favor de comunicarse con el remitente. Gracias.





More information about the Python-list mailing list