Error when using Generic and slots · Issue #332 · python/typing (original) (raw)
from typing import Generic, TypeVar
class C(Generic[TypeVar('T')]): slots = ('potato',)
ValueError: 'potato' in slots conflicts with class variable
C[int]
This is because bare C
is created with a class member descriptor potato
, and instantiating it tries to create a class with all the attributes in C
.