apply problems

Thomas Wouters thomas at xs4all.net
Sun Jul 15 16:41:36 CEST 2001


On Fri, Jul 13, 2001 at 10:50:57AM -0700, Curtis Jensen wrote:
> 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 ):

Note: this function requires 9 arguments, one of which ('self') is passed
implicitly when called through an instance. However, your error message 

> If I remove the "additional_kwds" from the apply call, then I get:
> TypeError: not enough arguments; expected 8, got 7

states otherwise. Conclusion: you're not using the code you say you are
using :)

The error you're seeing, "keyword parameter redefined", should not occur
given your code, and indeed I can't reproduce it. The 'keyword parameter
redefined' error *does* happen if your 'additional_kwds' dictionary contains
one of the 6 arguments you already pass in as positional arguments, though.

> 
> I can't figure out where the seventh argument is comming from. If I try:
> "cmd[1][6]" I get:

The seventh argument in the error message is of course the implicit 'self'
itself.

> 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. 

And *that*'s the biggest hint that you haven't described the real problem :)
If you can't reproduce what you think is the error, it's probably not the
real error.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list