[Python-ideas] Method chaining notation
Chris Angelico
rosuav at gmail.com
Sat Feb 22 16:54:26 CET 2014
On Sun, Feb 23, 2014 at 2:44 AM, Alan Cristhian Ruiz
<alan.cristh at gmail.com> wrote:
> What is wrong with the current sintax?:
>
> 'abcd'\
> .upper()\
> .lower()\
> .title()
It doesn't have each method operate on the original object. It's not
easy to see with strings, but try this:
list_of_numbers = [1,2]
list_of_numbers.append(3)
list_of_numbers.append(4)
list_of_numbers.append(5)
Now write that without repeating list_of_numbers all the way down the line.
ChrisA
More information about the Python-ideas
mailing list