[Python-ideas] Fast sum() for non-numbers - why so much worries?

Paul Moore p.f.moore at gmail.com
Wed Jul 10 08:33:13 CEST 2013


On 10 July 2013 07:09, Joshua Landau <joshua at landau.ws> wrote:

> I agree it's not totally backward-compatible, but AFAICT that's only
> for broken code. __iadd__ should always just be a faster, in-place
> __add__ and so this change should never cause problems in properly
> written code. That makes it anything but a semantic change. It's the
> same way people discuss the order of __hash__ calls on updates to code
> but no-one calls it a *semantics* change.
>

It will stop working for tuples (which have no __iadd__. Or were you
suggesting trying __iadd__ and falling back to __add__ (that's more
complex, obviously, and I don't think I'd assume it's "trivial" extra
complexity) or special-caseing tuples (that's even more complex, and
doesn't solve the problem for other iimmutables)?

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130710/9e884704/attachment.html>


More information about the Python-ideas mailing list