inconsistency with += between different types ?

Terry Reedy tjreedy at
Wed Aug 7 19:19:22 CEST 2002

"Andreas Leitgeb" <Andreas.Leitgeb at> wrote in message
> __iadd__ is SUPPOSED to modify self's attributes and then "return

Only if that is the sensible thing to do.

<suggestion to enforce above semantics by ignoring actual return and
substituting self>

> This would make sure that clean implementations would stay ok, while
> those implementations, that obfuscate the design of <op>= will
> phase out.

Python is not a nanny.  It's a language for consenting adults.  What
you do with your classes is your business.  If you use someone else's
classes, it is your responsibility to consider the sanity of the
source -- and to test.


More information about the Python-list mailing list