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.  |
[EMAIL PROTECTED]          +--------------------------------------+
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to