list.reverse

s.reverse() reverses the items of s in place

The list.sort and list.reverse methods modify the list in place for economy of space when sorting or reversing a large list. To remind you that they operate by side effect, they don’t return the sorted or reversed list.

 

Comment:

There should be a mention that, for iterating over a list in reverse order, the reversed() function is preferred.

Posted by Roberto Bonvallet (2006-10-27)

A Django site. this page was rendered by a django application in 0.02s 2008-08-29 23:34:59.883094. hosted by webfaction.