DB
Size: a a a
DB
MK
DB
MK
MK
math.absВТ
E
Б
types.ModuleTypeБ
**kwargs: T — относится к kwargs, а не к kwargs.values()?from typing import TypeVar, Generic, Dict
from typing_extensions import Literal
T = TypeVar('T')
class Foo(Generic[T]):
def method(self, **kwargs: T):
...
FooAB = Foo[Dict[Literal['a', 'b'], int]]
FooAB().method(
a=3, # ok
b=5, # this fine
c=3, # should give an error
)
p
Б
Б
Б
p
ED
E
p
A🚀
class Parent:
optional: Optional[str] = None
class Child(Parent):
required: str
Б
class Parent:
optional: Optional[str] = None
class Child(Parent):
required: str