Z
Zachary Pincus
Hi folks,
I'm sure this has come up before, but the search terms I've been
using are so non-specific that I can't get any traction on Google.
Here's my question:
I have written a subclass of ModuleType that handles lazy loading of
some slow resources. I would like a given module to be created as an
instance of that particular subclass on import, so that if I do:
import foo
type(foo)
I get <type 'myModule'> instead of <type 'module'>.
Is there any way to effect this? Something like __metaclass__ = ...
but at the beginning of a module instead of at the beginning of a class?
Thanks,
Zach Pincus
Program in Biomedical Informatics and Department of Biochemistry
Stanford University School of Medicine
I'm sure this has come up before, but the search terms I've been
using are so non-specific that I can't get any traction on Google.
Here's my question:
I have written a subclass of ModuleType that handles lazy loading of
some slow resources. I would like a given module to be created as an
instance of that particular subclass on import, so that if I do:
import foo
type(foo)
I get <type 'myModule'> instead of <type 'module'>.
Is there any way to effect this? Something like __metaclass__ = ...
but at the beginning of a module instead of at the beginning of a class?
Thanks,
Zach Pincus
Program in Biomedical Informatics and Department of Biochemistry
Stanford University School of Medicine