-
Couldn't load subscription status.
- Fork 275
Closed
Description
How to use typing in older versions seems a bit unclear, can you provide an example of how to use typing with older versions of python?
This doesn't seem to do anything:
def greeting(name): # type: (str) -> str
"""documentations"""
return ('Hello ' + name)
if __name__ == "__main__":
print (greeting("World"))
print (greeting(44)) # Doesn't catch invalid input type until i get to the string concat.
In addition, the __annotations__ property doesn't get added to the function:
import typing
def greeting(name): # type: (str) -> str
"""documentations"""
return ('Hello ' + name)
print(greeting.__annotations__) # fails because doesn't exist.
Please advise how this back port should be used properly for developers who need to maintain compatibility with older versions of Python (2.7.12 and 3.4).
Thank you
jlumbroso
Metadata
Metadata
Assignees
Labels
No labels