Aargh! Function takes exactly x arguments, y given..

Erik Max Francis max at alcyone.com
Mon Jun 18 11:19:30 EDT 2001


Anders And wrote:

> I am a happy pythoneer using a combination of C++ and Python for my
> everyday
> work.
> Usually, debugging is easy but every now and then, I get the "function
> takes
> exactly x arguments, y given" error message, clearly due to some other
> problem than what Python thinks. Does anybody have any experience with
> this
> particular error message? I don't know what triggers it and thinking
> back, I
> think I have solved most of my problems with this message with a major
> code
> rewrite.

The error means just what it says:  You are calling a function with too
many or too few arguments.  Why you're doing that exactly is something
we couldn't tell you without code examples that actually give you the
error.

Only thing I can think of is that you've got a confusion with bound and
unbound methods; if you call an unbound method (C.f where C is a class
and f is a method), then you need to provide an instance of C as the
first method (the implicit self method becomes explicit).

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ There are defeats more triumphant than victories.
\__/ Montaigne
    Alcyone Systems / http://www.alcyone.com/
 Alcyone Systems, San Jose, California.



More information about the Python-list mailing list