From e1d8f55b8601025e2bf5aca747c6d47bd77917d8 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 21 Mar 2016 13:30:24 -0700 Subject: [PATCH] Just refer to the spec in PEP 484 for straddling annotations instead of repeating the info in PEP 8. --- pep-0008.txt | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/pep-0008.txt b/pep-0008.txt index ca9cf7dbd..d88d11306 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -1289,21 +1289,8 @@ annotations are changing. the library author's permission) through the typeshed repo [4]_. - For code that needs to be backwards compatible, function annotations - can be added in the form of comments. Basically, this Python 3 annotation:: - - def embezzle(self, account: str, funds: int = 1000000, **fake_receipts: str) -> None: - """Embezzle funds from account using fake receipts.""" - - - is equivalent to the following:: - - def embezzle(self, account, funds=1000000, **fake_receipts): - # type: (str, int, **str) -> None - """Embezzle funds from account using fake receipts.""" - - - The mypy type checker [5]_ currently supports this syntax, and other - type checkers are encouraged to adopt it. + can be added in the form of comments. See the relevant section of + PEP 484 [5]_. .. rubric:: Footnotes @@ -1329,9 +1316,8 @@ References .. [4] Typeshed repo https://github.com/python/typeshed -.. [5] mypy type checker - http://mypy-lang.org - https://github.com/JukkaL/mypy +.. [5] Suggested syntax for Python 2.7 and straddling code + https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code