The only purpose of __slots__ is to save memory, though it doesn't save
a lot. Until PR #1162 gets merged, it's also abused by the pickling
system to give a list of the attributes to save, which makes pickles
unnecessarily large.

Le samedi 05 mai 2012 à 18:39 +0200, [email protected] a
écrit :
> Slightly related: Why __new__ is used so often instead of simply
> __init__? In basic for example it seams like __init__ is good enough.
> 
There are many cases where __new__ has to be used because the class
constructor can return instances of other classes (cf. Add(1, 2)). It
seems easier to use __new__ all the time than to have to worry about the
interaction of __new__ and __init__.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to