map
Michael Weiss
FooWeissBarMike at hotmail.com
Fri Jun 7 14:33:45 EDT 2002
More information about the Python-list mailing list
Fri Jun 7 14:33:45 EDT 2002
- Previous message (by thread): map
- Next message (by thread): map
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Would this work? ########## x = [1,2,3,4] y = 2 #this? print map(lambda z: pow(z,y), x) # or this? print map(pow, x, [y for z in xrange(len(x))]) ########## "Giorgi Lekishvili" <gleki at gol.ge> wrote in message news:3D007666.2B6D3582 at gol.ge... > Hi all! > > Is there a way to map a function with several arguments to a list? E.g., > > >>>import math > >>>import MLab > >>>a=MLab.rand(3,5) > >>>b=map(math.pow,a) > > of course, this doesn't work. > > What to do? My task is to optimize the power (i.e., y in pow(x,y)) to > achieve maximal performance. > > > thanx, > Giorgi > > PS: Perhaps I have missed the needed functionality, that's presented in > NumPy? > > >
- Previous message (by thread): map
- Next message (by thread): map
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list