Why list.sort() don't return the list reference instead of None?

vbgunz vbgunz at gmail.com
Mon May 8 22:34:06 EDT 2006


to throw fire on the fuel (:P), you can get the value back to an
in-place mutable change with a single expression...

mylist = [2,3,4,1]
print mylist.sort() or mylist

might not be too pythonic or maybe it is. I guess depends on what side
of the glass you might wish to view the solution :)




More information about the Python-list mailing list