Hello,
Here, I am proposing a change on python type annotation.
Python was born to be a simple and elegant language. However recent change has
again introduce new incompatibility to python.
The PEP 484 is proposing a type hint which can annotate the type of each
parameters. How ever code written in this format can not be run for python3.5
and below.
It is an exciting new feature to be able to know the data type from the code,
But I am afraid this is not worth such a incompatibility.
Here I want to propose a new way of annotation in python as follows
def reportAge(name, age):
''' this a a greeting function and some other comment...
!str, int -> str
'''
return name+' is ' + age
we can put the annotation in the comment block and use a symbol '!' or other
symbol suitable to lead a annotation line.
the annotation should be positionally corresponding to the parameters.
Shawn
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com