apply problem

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Jul 3 06:27:07 CEST 2001


Heiko Wundram wrote:
> 
>       apply(getattr(self,name),(attrs))

Try this instead:

   apply(getattr(self,name),(attrs,))

Note the presence of the extra comma. Without
it, you're not passing a tuple containing your
dictionary, but just the dictionary itself.

By the way, there's no need to use apply()
at all in this case. You could just write

   getattr(self,name)(attrs)

and get exactly the same effect.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list