[Python-Dev] Why is nb_inplace_power ternary?

"Martin v. Löwis" martin at v.loewis.de
Wed Feb 14 18:11:55 CET 2007


Thomas Wouters schrieb:
> 
> The same way += et al. are in-place: it would ask 'x' to modify itself, 
> if it can. If not, no harm done. (It would be called as 'x = ipow(x, n, 
> 10)' of course, just like 'x += n' is really 'x = x.__iadd__(n)')

I think this would violate the policy that a mutating function shouldn't
give the object being modified as the result - just as list.reverse
doesn't return the list, in addition to reversing it in-place.

Regards,
Martin



More information about the Python-Dev mailing list