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

David C. Ullrich ullrich at math.okstate.edu
Tue Jun 19 07:32:21 EDT 2001


On Mon, 18 Jun 2001 08:19:30 -0700, Erik Max Francis <max at alcyone.com>
wrote:

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

Or he's not calling the function that he thinks he is, possibly
because of an "import *".

(I refrained from guessing at first cuz I didn't want to leave
anything out. Is there a natural third possibility?)

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



David C. Ullrich
*********************
"Sometimes you can have access violations all the 
time and the program still works." (Michael Caracena, 
comp.lang.pascal.delphi.misc 5/1/01)



More information about the Python-list mailing list