Author Sergey
Recipients Ramchandra Apte, Sergey, aleax, ethan.furman, jcea, oscarbenjamin, serhiy.storchaka, terry.reedy
Date 2013-07-11.23:57:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373587072.69.0.906266066667.issue18305@psf.upfronthosting.co.za>
In-reply-to
Content
Steven D'Aprano noticed that there's an obscure case of:

>>> class A(list):
...     def __add__(self, other):
...         return A(super(A,self).__add__(other))
...     def __radd__(self, other):
...         return A(other) + self
...

Where:
>>> type( [1] + A([2]) )
<class '__main__.A'>

Is different from:

>>> type( [1].__add__(A([2])) )
<class 'list'>

To keep such an undefined behavior unchanged I updated the fastsum-special-tuplesandlists.patch to have a more strict type check.

In case somebody would like to test it, the patch is attached. It should work for both Python 2.7 and Python 3.3, and should introduce no behavior change.
History
Date User Action Args
2013-07-11 23:57:52Sergeysetrecipients: + Sergey, aleax, terry.reedy, jcea, ethan.furman, Ramchandra Apte, serhiy.storchaka, oscarbenjamin
2013-07-11 23:57:52Sergeysetmessageid: <1373587072.69.0.906266066667.issue18305@psf.upfronthosting.co.za>
2013-07-11 23:57:52Sergeylinkissue18305 messages
2013-07-11 23:57:52Sergeycreate