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

bruno at modulix onurb at xiludom.gro
Tue May 9 08:43:59 EDT 2006


vbgunz wrote:
> 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 :)

Anyway, please do us a favor : avoid using such a thing in production
code !-)



-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list