Use a separate type variable for unique() (#1138)

* Use a separate type variable for unique()

See https://github.com/python/typeshed/pull/1136#discussion_r109727053

* actually use the new typevar
This commit is contained in:
Guido van Rossum
2017-04-04 23:48:19 -07:00
committed by Jelle Zijlstra
parent 47c325c0ae
commit f44e461d19

View File

@@ -2,6 +2,7 @@ import sys
from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type
_T = TypeVar('_T', bound=Enum)
_S = TypeVar('_S', bound=Type[Enum])
class EnumMeta(type, Iterable[Enum]):
def __iter__(self: Type[_T]) -> Iterator[_T]: ... # type: ignore
@@ -21,7 +22,7 @@ class Enum(metaclass=EnumMeta):
class IntEnum(int, Enum):
value = ... # type: int
def unique(enumeration: _T) -> _T: ...
def unique(enumeration: _S) -> _S: ...
if sys.version_info >= (3, 6):
_auto_null = ... # type: Any