1

Github Virtual subclasses of abstract base classes · Issue #1459 · python/mypy ·...

 3 years ago
source link: https://github.com/python/mypy/issues/1459
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Comments

Seeing a couple of different errors with virtual subclasses:

from abc import ABCMeta
class M(metaclass=ABCMeta):
    pass
class A:
    pass
M.register(A)  # error: "M" has no attribute "register"
def test(obj: M):
    pass
obj = A()
test(obj)  # error: Argument 1 to "test" has incompatible type "A"; expected "M"

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK