Consider __doc__ always Optional. (#641)

python/mypy#2380 showed a discrepancy between object and FunctionType in stdlib2. The first defined __doc__ to be str, the second Optional[str]. As FunctionType depends on object, this is no longer valid.

As suggested by @gvanrossum in python/mypy#2380, all __doc__ should be considered Optional.

(Final verdict was just to remove most __doc__ attributes since it's inherited from object.)
This commit is contained in:
TrueBrain
2016-10-30 19:48:23 +01:00
committed by Guido van Rossum
parent 1d47c6fdb8
commit 15ec66cdd6
14 changed files with 2 additions and 29 deletions

View File

@@ -12,7 +12,6 @@ def abstractmethod(funcobj: Any) -> Any: ...
class ABCMeta(type):
# TODO: FrozenSet
__abstractmethods__ = ... # type: Set[Any]
__doc__ = ... # type: str
_abc_cache = ... # type: _weakrefset.WeakSet
_abc_invalidation_counter = ... # type: int
_abc_negative_cache = ... # type: _weakrefset.WeakSet
@@ -31,7 +30,6 @@ class _C:
# TODO: The real abc.abstractproperty inherits from "property".
class abstractproperty(object):
def __new__(cls, func: Any) -> Any: ...
__doc__ = ... # type: str
__isabstractmethod__ = ... # type: bool
doc = ... # type: Any
fdel = ... # type: Any