Keep getting this in PyDev "TypeError: quiz() takes exactly 1 argument (0 given)"

Terry Reedy tjreedy at udel.edu
Fri Aug 10 22:27:46 CEST 2012


On 8/10/2012 2:52 PM, Chuck wrote:
> Hi all, I cannot figure why I keep getting this error.

To supplement Dave's answer (post entire traceback, dedent last two 
lines), here are the essentials of your code that show the problem.

 >>> class C:
	def f(self): pass
	f()
	
Traceback (most recent call last):
   File "<pyshell#17>", line 1, in <module>
     class C:
   File "<pyshell#17>", line 3, in C
     f()
TypeError: f() missing 1 required positional argument: 'self'

You problem is that you are calling the function during the execution of 
the class statement, *before* the class is created.
Rather unusual ;-).

-- 
Terry Jan Reedy



More information about the Python-list mailing list