> Nature was a horrible word for me to use; what I was trying to convey > was that there are so many mays to analyze an object besides just the > type (which I assume directly refers to the return value of type(object) > as opposed to some loose concept of 'type' as in style) of the object. > Like some of the examples I gave earlier, in_range, i.e.: type(thing) and isinstance(thing, typ) are the only reliable methods we have for determining the "nature" of what an object really is. In terms of general validation of input, that is also solved by the general decorator syntax. You can wrap your function with any arbitrary argument or return validation as you see fit, if I remember correctly, such decorators are even planned to be in the standard library somewhere. > which is very different from pure type checking which I assume would be: > > def func(a: int): pass > > which simply translates to an 'isinstance(a, int)' call, where 'a' is a > variable and 'int' is a type object. Aside from your "validator" syntax, which I hope /never/ makes it into Python, we understand what you are saying, however, as I said before (and as you didn't listen to), such runtime pre and post validation is currently possible in Python. Certainly it isn't part of the /syntax/ of Python, but I don't believe such type checking or input validation should be a part of Python syntax. Considering that what you desire is already possible to do, and will be made easier with decorators, what else do you want? - Josiah
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4