Question on passing function as argument
matthew
matthew at newsgroups.com
Mon Mar 31 16:24:59 EST 2003
More information about the Python-list mailing list
Mon Mar 31 16:24:59 EST 2003
- Previous message (by thread): Question on passing function as argument
- Next message (by thread): Question on passing function as argument
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Previous message (by thread): Question on passing function as argument
- Next message (by thread): Question on passing function as argument
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list