Mark Bryan Yu <[EMAIL PROTECTED]> writes:

> This set of codes works:
>
>>>> x = range(5)
>>>> x.reverse()
>>>> x
> [4, 3, 2, 1, 0]
>
> But this doesn't:
>
>>>> x = range(5).reverse()
>>>> print x
> None
>
> Please explain this behavior. range(5) returns a list from 0 to 4 and
> reverse just reverses the items on the list that is returned by
> range(5). Why is x None (null)?

have you tried typing help(list.reverse) at the interactive prompt?

-- 
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to