[Python-Dev] Autoloading? (Making Queue.Queue easier to use)
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Oct 13 05:44:21 CEST 2005
Michael Chermside wrote:
> # start of module
> initialized = False
>
> def doSomething():
> if not initialized:
> initialize()
But how do you do this if the thing in question is a
class rather than a function?
The module could export a function getSomeClass()
that clients were required to use instead of just
referencing the class, but that would be klunky
in the extreme.
BTW, I agree that special *syntax* isn't necessarily
needed. But it does seem to me that some sort of
hook is needed somewhere to make this doable
smoothly, that doesn't exist today.
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list