2 Oct
2020
2 Oct
'20
2:49 a.m.
-1 for various reasons expressed by several authors. But I'm not sure I agree with this: Steven D'Aprano writes:
I think this might make good sense for string methods:
mystring = mystring.upper() mystring .= upper()
but less so for arbitrary objects with methods returning arbitrary values, or methods that operate in place.
l = [0] l *= 5 l [0, 0, 0, 0, 0]
Operators are just functions. In most cases, we try to define them as algebraic operations, but occasionally there's reason to do otherwise. When we do, often the augmented assignment operators do sane things, too. I don't see why that wouldn't be true for '.', although I don't think that's a slam dunk either, '.' is different from most operators.