[Python-ideas] list…pushed, or something

Terry Reedy tjreedy at udel.edu
Fri Mar 29 19:00:05 CET 2013

On 3/29/2013 7:40 AM, Joao S. O. Bueno wrote:

> I understand that the equivalent methods in other languages - sometimes
> frameworks int hose languages  - allow one to chain method calls on the
> parent object, so they can happly write things along:
> list().append(1).append(0).sort().append(2)
> Python style, as well placed on the thread is that methods that perform
> changes to the underlying object return None,

Unless the method returns something else other than the underlying 
mutable. Examples are list.pop, set.pop, dict.pop, and dict.popitem, 
which return the item (or pair) removed.

Terry Jan Reedy

More information about the Python-ideas mailing list