[Python-ideas] Suggestions: dict.flow_update and dict.__add__
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Mar 5 17:56:33 EST 2019
Christopher Barker wrote:
> That violates an important convention in Python: mutating methods do not
> return self. We really want to preserve that convention.
Smalltalk has an abbreviated way of writing a series of method
calls to the same object:
x doThis; doThatWith: y; doTheOther.
is equivalent to
x doThis.
x doThatWith: y.
x doTheOther.
Something like this could no doubt be added to Python, but I'm
not sure it would be worth the bother. Giving a short name to the
recipient and then writing the calls out explicitly isn't much
harder and is clearer to read, IMO.
--
Greg
More information about the Python-ideas
mailing list