Multiple constructors
Steven Bethard
steven.bethard at gmail.com
Sun Feb 6 14:44:01 EST 2005
Alex Martelli wrote:
> If you want to do this
> all the time, you could even build appropriate infrastructure for this
> task -- a little custom descriptor and metaclass, and/or decorators.
> Such infrastructure building is in fact fun and instructive -- as long
> as you don't fall into the trap of *using* such complications in
> production code, where Python's simplicity rules;-).
+1 QOTW.
I think this is one of the "great truths" of Python. Descriptors,
metaclasses, decorators, etc. are all there to let you do interesting,
useful things. But if you're using such constructs for more than a few
special cases, then you're missing out on a simple solution that Python,
almost certainly, makes beautiful.
Steve
More information about the Python-list
mailing list