Q. Do you want to do something like generics that takes value from []?
A. Yes. (Use __class_getitem__)
__class_getitem__
class Hello: def __class_getitem__(self, v): return v print(Hello["sh1ma"])
Recommended Posts