multiply utple or list
Karl Scalet
news at yebu.de
Thu Feb 19 10:58:02 EST 2004
More information about the Python-list mailing list
Thu Feb 19 10:58:02 EST 2004
- Previous message (by thread): multiply utple or list
- Next message (by thread): hmm, lets call it: generic __init__ problem ['LBBW': checked]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Diez B. Roggisch wrote: >> >>> import operator >> >>> [ operator.mul(x,2) for x in (4,5)] > > > Why not simply * ? > > [ x * 2 for x in (4,5)] > oops, of course. I had the map function in mind, which only accepts a function, but this would come to something like: li=(4,5) map(operator.mul, li, (2,)*len(li)) and is certainly worse then list comprehension :-) regards, Karl
- Previous message (by thread): multiply utple or list
- Next message (by thread): hmm, lets call it: generic __init__ problem ['LBBW': checked]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list