Přečti kód pozorně
from typing import Annotated, get_type_hints, get_args, get_origin
class Range:
def __init__(self, lo: int, hi: int) -> None:
self.lo = lo
self.hi = hi
def __repr__(self) -> str:
return f"Range({self.lo}-{self.hi})"
def set_age(age: Annotated[int, Range(0, 120)]) -> None:
pass
hints = get_type_hints(set_age, include_extras=True)
ann = hints["age"]
print(repr(ann))
print(get_origin(ann))
print(get_args(ann))
print(get_args(ann)[0])
print(get_args(ann)[1])
Co program vypíše? Napiš sem: