List mapping?
Alex
cut_me_out at hotmail.com
Thu Apr 13 10:53:13 EDT 2000
More information about the Python-list mailing list
Thu Apr 13 10:53:13 EDT 2000
- Previous message (by thread): List mapping?
- Next message (by thread): List mapping?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
from operator import getitem
def pair (l):
assert len (l) % 2 == 0
evens = range (0, len (l), 2)
evens = map (getitem, len (evens) * [l], evens)
odds = range (1, len (l), 2)
odds = map (getitem, len (odds) * [l], odds)
return map (None, evens, odds)
if __name__ == '__main__':
print pair (range (10))
Alex.
- Previous message (by thread): List mapping?
- Next message (by thread): List mapping?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list