Alan Gauld wrote: > "Asrarahmed Kadri" <[EMAIL PROTECTED]> wrote > >> I mean to say that suppose I have two lists, and I want to pass them >> to the >> event handling function. Is that possible using bind? > > Not answering your question directly but you can do > it with a lambda expression. > > def myfunc(l1,l2): > # the func I want to use > > foo = lambda p1=list1, p2=list2: myfunc(p1,p2) > bind(e,foo) > > or just > > bind(e,lambda p1=list1, p2=list2: myfunc(p1,p2)) > > Obviously(?) list1 and list2 need to be in the same scope as > the lambda expression!
Unless the bind() is in a loop that is rebinding list1 and list2, the named parameters are not needed since nested scopes were introduced in Python 2.1, you can just write bind(e,lambda: myfunc(list1, list2)) Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor