Michael Torrie <[EMAIL PROTECTED]> wrote:
> poof65 wrote:
>> An idea, i don't know if it will work in your case.
>>
>> for x in xrange(10):
>> funcs.append(lambda p,z=x: testfunc(z+2,p))
>
> Good idea. I will try it. I also figured out a way to architecture my
> program differently to avoid
"Michael Torrie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
|I need to use a lambda expression
Lambda expressions are a convenience, not a necessity. When having a
problem, it sometimes helps to revert to the unabbreviated def statement.
tjr
--
http://mail.python.org/mail
On Mar 1, 8:50 pm, Michael Torrie <[EMAIL PROTECTED]> wrote:
> I need to use a lambda expression to bind some extra contextual data
> (should be constant after it's computed) to a call to a function. I had
> originally thought I could use something like this demo (but useless) code:
>
> funcs=[]
>
poof65 wrote:
> An idea, i don't know if it will work in your case.
>
> for x in xrange(10):
> funcs.append(lambda p,z=x: testfunc(z+2,p))
Good idea. I will try it. I also figured out a way to architecture my
program differently to avoid this problem. But this idiom might be
handy in certain
An idea, i don't know if it will work in your case.
for x in xrange(10):
funcs.append(lambda p,z=x: testfunc(z+2,p))
On Sun, Mar 2, 2008 at 3:50 AM, Michael Torrie <[EMAIL PROTECTED]> wrote:
> I need to use a lambda expression to bind some extra contextual data
> (should be constant after it's
I need to use a lambda expression to bind some extra contextual data
(should be constant after it's computed) to a call to a function. I had
originally thought I could use something like this demo (but useless) code:
funcs=[]
def testfunc(a,b):
print "%d, %d" % (a,b)
for x in xrange(10):