Why doesn't python's list append() method return the list itself?

Thomas Jollans thomas at jollans.com
Sun Jul 11 12:39:41 EDT 2010


On 07/11/2010 06:28 PM, Nathan Rice wrote:
> Do list(reversed(list(reversed([1, 2, 3, 4])) + [[]]))
> 
> Though TBH sometimes get annoyed at this behavior myself.  There are a
> lot of people who are very vocal in support of returning none, and it
> makes sense in some ways.  Since reversed returns an iterator though, it
> makes this code horrible and unreadable.
> 

ah yes, forgot about that nuance. casting reversed to list. Still, there
is slicing.



More information about the Python-list mailing list