[issue44807] typing.Protocol silently overrides __init__ method of delivered class

Adrian Garcia Badaracco report at bugs.python.org
Tue Mar 1 01:00:41 EST 2022


Adrian Garcia Badaracco <adrian at adriangb.com> added the comment:

Agreed.

What if we allow protocols that implement `__init__` but still disallow instantiating a protocol that does not? It's a 1 line change, all existing tests pass and it would still catch what I think was the original intention (trying to instantiate a Protocol class with no __init__): https://github.com/python/cpython/pull/31628/files#diff-ddb987fca5f5df0c9a2f5521ed687919d70bb3d64eaeb8021f98833a2a716887

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44807>
_______________________________________


More information about the Python-bugs-list mailing list