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)?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to