-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-descriptorsProperties, class vs. instance attributesProperties, class vs. instance attributes
Description
This code is not considered valid by mypy:
from abc import abstractmethod
class Array(object):
@property
@abstractmethod
def _length_(self) -> int: ...
@_length_.setter
@abstractmethod
def _length_(self, value: int) -> None: ...
Output:
out/ex.py:4: error: Overloaded method has both abstract and non-abstract variants
out/ex.py:7: error: Decorated property not supported
But, this code is valid:
- It works in runtime
- It is documented here: https://docs.python.org/3/library/abc.html#abc.abstractproperty
- It has clear semantics: we need subclasses of this type to have a read/write property implementation
Refs python/typeshed#6361
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-descriptorsProperties, class vs. instance attributesProperties, class vs. instance attributes