I talked about this before but I have slightly different suggestions
list[type] becomes [type]
tuple[type1, type2, type3] becomes (type1, type2, type3)
dict[type1, type2] becomes {type1: type2}
set[type] becomes {type}
Callable[[type1], type2] becomes (type1) -> type2
class MyTypedDict(TypedDict):
name: str
age: NotRequired[int]
becomes {name: str, age: NotRequired[int]}
Unfortunately, the steering committee rejected the callable syntax last year even though I think the proposal was elegant and a lot of efforts went into it. Maybe they will reconsider it in the future with some modifications? I don’t know.
Abdulla
Sent from my iPhone