[Python-Dev] How to suppress instance __dict__?
Delaney, Timothy C (Timothy)
tdelaney at avaya.com
Sun Mar 23 19:09:25 EST 2003
> From: David Abrahams [mailto:dave at boost-consulting.com]
>
> Guido van Rossum <guido at python.org> writes:
>
> > So I don't think __new__ is preferred over __init__, unless
> you need a
> > feature that only __new__ offers (like initializing an
> immutable base
> > class or returning an existing object or an object of a different
> > class).
>
> In other words, TIMTOWTDI? <0.3 wink>
[Moved to python-list as I think it's gone well beyond python-dev].
I wouldn't say that. Use __init__ unless you *must* use __new__. And when you use __new__, still use __init__ for initialisation.
And if you are going to use __new__, you are expected to be able to explain *why*.
Pretty straightforward to me.
Tim Delaney
More information about the Python-list
mailing list