E
elsa
Hi,
i have a question about the built in map function. Here 'tis:
say I have a list, myList. Now say I have a function with more than
one argument:
myFunc(a, b='None')
now, say I want to map myFunc onto myList, with always the same
argument for b, but iterating over a:
map(myFunc(b='booHoo'), myList)
Why doesn't this work? is there a way to make it work?
(Ultimately, I want to call myFunc(myList[0], 'booHoo'), myFunc(myList
[1], 'booHoo'), myFunc(myList[2], 'booHoo') etc. However, I might want
to call myFunc(myList[0], 'woo'), myFunc(myList[1], 'woo'), myFunc
(myList[2], 'woo') some other time).
Thanks,
Elsa
i have a question about the built in map function. Here 'tis:
say I have a list, myList. Now say I have a function with more than
one argument:
myFunc(a, b='None')
now, say I want to map myFunc onto myList, with always the same
argument for b, but iterating over a:
map(myFunc(b='booHoo'), myList)
Why doesn't this work? is there a way to make it work?
(Ultimately, I want to call myFunc(myList[0], 'booHoo'), myFunc(myList
[1], 'booHoo'), myFunc(myList[2], 'booHoo') etc. However, I might want
to call myFunc(myList[0], 'woo'), myFunc(myList[1], 'woo'), myFunc
(myList[2], 'woo') some other time).
Thanks,
Elsa