apply problems

Curtis Jensen cjensen at bioeng.ucsd.edu
Fri Jul 13 13:50:57 EDT 2001


Python 1.5.2
Irix 6.5


In my code, I have the line:
apply( self.ren.Elements, cmd[1], additional_kwds )

and I get the error:
TypeError: keyword parameter redefined


where:
cmd[1] = [0, 0, 3, 3, 0.0, [0]]

additional_kwds = {'prob': None, 'datum': None, 'elements': 
<cont_classes.Elements.Elements instance at 103849c0>, 'nodes': 
<cont_classes.Nodes.Nodes instance at 10384750>}

def Elements( self, at, deformed, iact, normal, xi, nelist, nodes,
elements, *args, **kwds ):



However, if I replace the apply command with:
self.ren.Elements( cmd[1][0], cmd[1][1], cmd[1][2], cmd[1][3],
cmd[1][4], cmd[1][5], additional_kwds )

It works fine.  I can't figure why the apply line doesn't work.  There
are 8 arguments to self.ren.Elements (excluding self). There are 6 items
in "cmd[1]."  The remaining two are taken care of in "additional_kwds." 
I know what the error means, I just don't see where the redefined keword
is.  If I remove the "additional_kwds" from the apply call, then I get:
TypeError: not enough arguments; expected 8, got 7

I can't figure out where the seventh argument is comming from. If I try:
"cmd[1][6]" I get:
IndexError: list index out of range
and "len(cmd[1]" gives 6.

I am unable to repeat this in a simple example, so I am forced to merely
describe the problem as best as I can.  The code is too big to post. 
Any suggestions?  Thanks.


-- 
Curtis Jensen
cjensen at bioeng.ucsd.edu
http://www-bioeng.ucsd.edu/~cjensen/
FAX (425) 740-1451



More information about the Python-list mailing list