little problem with list.reverse() function
Roy Smith
roy at panix.com
Sat Sep 11 12:06:03 EDT 2004
In article <LRE0d.236333$OR2.10714605 at news3.tin.it>,
manuel <manuelbastioniNOSPAM at tin.it> wrote:
> >>> a = [[1,2],[2,3],[4,5]]
> >>> print a
> [[1, 2], [2, 3], [4, 5]]
> >>> print a.reverse()
> None
> >>>
>
>
>
> ???
> Thanks...
The reverse() method of lists reverses the list in-place, and returns
None on purpose. Almost everybody finds this surprising when they
discover it for the first time. Many people (myself included) consider
it a design flaw. But, it is an intentional design decision, not a bug.
More information about the Python-list
mailing list