why i can't reverse a list of list in python

i wanted to do something like this but this code return list of None (i think it's because list.reverse() is reversing the list in place):

map(lambda row: row.reverse(), figure)

i tried this one, but the reversed return an iterator :

map(reversed, figure)

finally i did something like this , which work for me , but i don't know if it's the right solution:

def reverse(row):
    """func that reverse a list not in place"""
    row.reverse()
    return row

map(reverse, figure)

if someone has a better solution that i'm not aware of please let me know

kind regards,

11
задан Martijn Pieters 1 September 2016 в 16:00
поделиться