On Tue, Mar 1, 2016 at 2:27 PM, Terry Reedy <tjre...@udel.edu> wrote: > On 3/1/2016 12:24 PM, ast wrote: > >> class Premiere: >> def __init__(self, price): >> pass >> p = Premiere(1000) >> >> which is OK. > > Premiere is callable because it inherits object.__call__. That function, or > the implementation of the CALL FUNCTION bytecode, must notice that > Premiere.__new__ is object.__new__, by inheritance, and only pass Premiere > and not 1000.
It's not handled in bytecode or __call__. In CPython the type_call function passes its args and kwds to the type's tp_new and tp_init functions without modification. object.__new__ ignores the excess arguments in this case, as described in my previous message. While I think the cases where object.__new__ and object.__init__ ignore excess arguments are practical and sensible, they should still be documented. AFAICT, the language reference has nothing to say on this matter. -- https://mail.python.org/mailman/listinfo/python-list