"David" <bouncingc...@gmail.com> wrote
clever enough to refuse to instantiate itself if a necessary
condition
is not met.
Oops, sent too soon.
I meant to add that you should realize that the implication of your
design is that the user of the class now has to check each object
to see if it is a valid reference or None. You could raise an
exception
instead of returning None which allows a try/except style...
This extra overhead is one reason these kinds of "clever" tricks
are usually avoided. A valid object with null content is often
preferrable, or a singleton style pattern. But occasionally your
style is needed, just be aware of the extra overhead you
introduce by using it.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor