list.reverse()
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Wed Apr 30 03:57:11 EDT 2008
En Tue, 29 Apr 2008 10:32:46 -0300, Roy Smith <roy at panix.com> escribió:
> What you want to do is look at the reversed() function. Not only does it
> return something (other than Null), but it is much faster because it
> doesn't have to store the reversed list anywhere. What it returns is an
> iterator which walks the list in reverse order.
> Same with list.sort() vs. the global sorted().
No, sorted() returns a -newly created- true list, not an iterator. Its
argument may be any iterable, but the result is always a list.
--
Gabriel Genellina
More information about the Python-list
mailing list