James Stroud <[EMAIL PROTECTED]> writes:
> Actually, lambda is not necessary for event binding, but a closure (if
> I have the vocab correct), is: ...
>
> def make_it(x):
> def highliter(x=x):
> print "highlight", x
> return highliter
For that version you shouldn't need the x=x:
def make_it(x):
def highliter():
print "highlight", x
return highliter
The reason is each time you call make_it, you're creating a new scope
where x has the correct value, and highliter keeps referring to that
scope even after make_it has returned.
--
http://mail.python.org/mailman/listinfo/python-list