On 11/22/2013 6:26 AM, Steven D'Aprano wrote:
A frequently missed feature is the ability to chain method calls:

x = []
x.append(1).append(2).append(3).reverse().append(4)
=> x now equals [3, 2, 1, 4]


This doesn't work with lists, as the methods return None

True for the 7 pure mutation methods but not for .copy, .count, .index, and .pop. The last both mutates and returns.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to