[Python-Dev] In-place operators

Hrvoje Niksic hrvoje.niksic at avl.com
Wed Mar 18 12:47:18 CET 2009


Martin v. Löwis wrote:
> Certainly, the doc string is wrong:
> 
>   isub(a, b) -- Same as a -= b.
> 
> That's not quite the same - you would have to write
> 
>   a = isub(a, b) -- Same as a -= b.

It seems a perfectly fine solution is simply to fix the docstring, 
exactly like that:

a = isub(a, b) -- Same as a -= b.

This both corrects the error when using isub with immutable types and 
educates user as to how a -= b actually works.


More information about the Python-Dev mailing list