[Python-Dev] PEP 484
Shawn Chen
shawnchen1996 at outlook.com
Thu Jul 5 00:01:24 EDT 2018
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180705/4016ea11/attachment.html>
More information about the Python-Dev
mailing list