This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: keyworded argument count is wrong
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Albert.Zeyer, benjamin.peterson
Priority: normal Keywords:

Created on 2015-04-17 14:40 by Albert.Zeyer, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg241335 - (view) Author: Albert Zeyer (Albert.Zeyer) * Date: 2015-04-17 14:40

class C(object):
	def __init__(self, a, b=2, c=3):

class D(C):
	def __init__(self, d, **kwargs):
		super(D, self).__init__(**kwargs)

class E(D):
	def __init__(self, **kwargs):
		super(E, self).__init__(**kwargs)

E(d=42, b=0, c=0)

You get the funny message:

TypeError: __init__() takes at least 2 arguments (3 given)
msg241338 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2015-04-17 15:05
This is a well-known shortcoming of 2.x function signature errors. The situation is much improved in 3.x:

TypeError: __init__() missing 1 required positional argument: 'a'
Date User Action Args
2022-04-11 14:58:15adminsetgithub: 68176
2015-04-17 15:05:41benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg241338

resolution: wont fix
2015-04-17 14:40:27Albert.Zeyercreate