Where are the Type annotation constraints (`ValueRange`/`MinLen` etc) in python 3.9? Where are the Type annotation constraints (`ValueRange`/`MinLen` etc) in python 3.9? python-3.x python-3.x

Where are the Type annotation constraints (`ValueRange`/`MinLen` etc) in python 3.9?


As others have said, these classes are just an example of what can be annotated. Annotation just grabs a certain variable and adds some "hints" to them via the class you created (MaxLen, ValueRange, etc).

You can then obtain which "hints" are related to every parameter using get_type_hints, and crawl one per one the parameters with its hits and do the checks you want (not the idea Annotation was intended, though I also found it interesting). You have a full example in this other post.