Type hints like in PEP 484 work on all Python 3 versions, and something similar to your proposal is already supported on Python 2 [1]. [1]: https://mypy.readthedocs.io/en/latest/python2.html On July 4, 2018 11:08:27 PM Shawn Chen <shawnchen1996 at outlook.com> wrote: > 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 > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180704/4bc1a71b/attachment.html>
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