Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

Your metaclass.__new__ method returns None instead of the new class. The rule 
for calling __init__ is:

- if the constructor __new__ returns an instance of the type, then call the 
initializer __init__

- otherwise, don't call __init__ at all.

https://docs.python.org/3/reference/datamodel.html#object.__new__

Since your __new__ accidentally returns None, the __init__ is not called. If 
you change the line to say 

return super().__new__(cls, *args, **kwargs)

you will see that __init__ is called. (And discover the bugs in your init 
method :-)

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36178>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to