Question on passing function as argument
matthew
matthew at newsgroups.com
Mon Mar 31 16:24:59 EST 2003
Hi,
Howto pass a func as an argument to a list?
Given:
def add_listener(self, event, listener = None):
print event, " : ", listener
if event in self.event_list:
for item in listener:
self.event_list[event].append(item)
<main>
event.add_listener('linear', ['linear']) correctly adds 'linear' to list
but if I do:-
event.add_listener('linear', [calc_position(params)])
the function seems to execute 'in-place' and the event_list[event] shows
None.
What am I doing wrong? Thanks. matthew.
More information about the Python-list
mailing list