for loop possible enhancement
Will Ware
wware at world.std.com
Fri Sep 22 14:44:01 EDT 2000
More information about the Python-list mailing list
Fri Sep 22 14:44:01 EDT 2000
- Previous message (by thread): for loop possible enhancement
- Next message (by thread): for loop possible enhancement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
bob van der Poel (bvdpoel at uniserve.com) wrote: > What > I'm wondering is if it might be possible to add to the for syntax > something like: > for a in [1,2,3,4], b in [a,b,c,d]: Try this: >>> for x, y in map(None, [1,2,3,4], ['a','b','c','d']): ... print 'x', x, 'y', y ... x 1 y a x 2 y b x 3 y c x 4 y d A little cumbersome, but it works. The map(...) expression returns [(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd')]. -- # - - - - - - - - - - - - - - - - - - - - - - - - # Resistance is futile. Capacitance is efficacious. # Will Ware email: wware @ world.std.com
- Previous message (by thread): for loop possible enhancement
- Next message (by thread): for loop possible enhancement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list