Closed
Description
Sample:
from abc import abstractmethod
from typing import *
T = typevar('T')
class Rnd(Protocol[T]):
@abstractmethod
def some_method(x: T) -> T:
pass
That gives:
err.py, line 2: Name 'T' already defined
err.py, line 2: Name 'abstractmethod' already defined
err.py, line 6: Name 'Protocol' is not defined
Removing the top line solves the second error, but it obviously doesn't run under Python 3:
Traceback (most recent call last):
File "err.py", line 6, in <module>
class Rnd(Protocol[T]):
File "err.py", line 7, in Rnd
@abstractmethod
NameError: name 'abstractmethod' is not defined