Logo

Programming-Idioms

History of Idiom 19 > diff from v18 to v19

Edit summary for version 19 by :

Version 18

2015-10-31, 16:25:55

Version 19

2015-11-30, 12:37:26

Idiom #19 Reverse a list

Reverse the order of the elements of list x .
This may reverse "in-place" and destroy the original ordering.

Idiom #19 Reverse a list

Reverse the order of the elements of list x .
This may reverse "in-place" and destroy the original ordering.

Code
x = reversed(x)
Code
x = reversed(x)
Comments bubble
returns an iterable.
on lists this creates a new list.
Comments bubble
returns an iterable.
on lists this creates a new list.
Doc URL
https://docs.python.org/3/library/functions.html#reversed
Doc URL
https://docs.python.org/3/library/functions.html#reversed
Origin
http://stackoverflow.com/a/3940137/871134
Origin
http://stackoverflow.com/a/3940137/871134