From f8da366c01385b1add4c1a21cfaef262d712c9e9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 8 Jun 2022 23:20:36 +0300 Subject: [PATCH 1/6] PEP 484: Fix WARNING: Citation [peps] is not referenced --- pep-0484.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pep-0484.txt b/pep-0484.txt index e33754b9759..b3dcbbf505c 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -2438,7 +2438,7 @@ issue tracker [issues]_, where much of the technical discussion takes place. The draft on GitHub is updated regularly in small increments. The -official PEPS repo [peps_] is (usually) only updated when a new draft +official PEPS repo [peps]_ is (usually) only updated when a new draft is posted to python-dev. From 121312bdd03371495d37009ab3f577480ee700a1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 8 Jun 2022 23:37:25 +0300 Subject: [PATCH 2/6] PEP 484: Fix WARNING: duplicate citation mypy, other instance in pep-0482.txt --- pep-0484.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt index b3dcbbf505c..b4aaa7fd17d 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -2460,9 +2460,6 @@ Raoul-Gabriel Urma, and Julien Verlaguet. References ========== -.. [mypy] - http://mypy-lang.org - .. [gvr-artima] http://www.artima.com/weblogs/viewpost.jsp?thread=85551 From 33e4e62da48e019ed3d1e8b9d63db80e1fe939ad Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 8 Jun 2022 23:38:47 +0300 Subject: [PATCH 3/6] PEP 484: Fix warnings: remove unused citations --- pep-0484.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt index b4aaa7fd17d..bcc0dd5aa5b 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -2469,12 +2469,6 @@ References .. [typeshed] https://github.com/python/typeshed/ -.. [pyflakes] - https://github.com/pyflakes/pyflakes/ - -.. [pylint] - http://www.pylint.org - .. [roberge] http://aroberge.blogspot.com/2015/01/type-hinting-in-python-focus-on.html From e19166384c5d4a1a8e8a308d21b7d552519de4af Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 8 Jun 2022 23:39:01 +0300 Subject: [PATCH 4/6] PEP 484: Remove redundant emacs metadata --- pep-0484.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt index bcc0dd5aa5b..dcdf9d94b9b 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -2489,14 +2489,3 @@ Copyright ========= This document has been placed in the public domain. - - - -.. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - coding: utf-8 - End: From 88b834e6cad4a0c3b713e6261c325db8708a5b65 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 9 Jun 2022 00:33:18 +0300 Subject: [PATCH 5/6] PEP 484: Inline the references --- pep-0484.txt | 56 +++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt index dcdf9d94b9b..3d75a3352d4 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -68,8 +68,8 @@ Rationale and Goals :pep:`3107` added support for arbitrary annotations on parts of a function definition. Although no meaning was assigned to annotations -then, there has always been an implicit goal to use them for type -hinting [gvr-artima]_, which is listed as the first possible use case +then, there has always been an `implicit goal to use them for type +hinting `_, which is listed as the first possible use case in said PEP. This PEP aims to provide a standard syntax for type annotations, @@ -760,8 +760,8 @@ to the list, which would violate the variable's type in the caller. It turns out such an argument acts *contravariantly*, whereas the intuitive answer (which is correct in case the function doesn't mutate its argument!) requires the argument to act *covariantly*. A longer -introduction to these concepts can be found on Wikipedia -[wiki-variance]_ and in :pep:`483`; here we just show how to control +introduction to these concepts can be found on `Wikipedia +`_ and in :pep:`483`; here we just show how to control a type checker's behavior. By default generic types are considered *invariant* in all type variables, @@ -1660,7 +1660,7 @@ Additional notes on stub files: exported. (This makes it easier to re-export all objects from a given module that may vary by Python version.) -* Just like in normal Python files [importdocs]_, submodules +* Just like in `normal Python files `_, submodules automatically become exported attributes of their parent module when imported. For example, if the ``spam`` package has the following directory structure:: @@ -1861,8 +1861,8 @@ enabled by including a file named ``py.typed`` in the package.) The Typeshed Repo ----------------- -There is a shared repository where useful stubs are being collected -[typeshed]_. Policies regarding the stubs collected here will be +There is a `shared repository `_ where useful stubs are being +collected. Policies regarding the stubs collected here will be decided separately and reported in the repo's documentation. Note that stubs for a given package will not be included here if the package owners have specifically requested that they be omitted. @@ -2365,8 +2365,9 @@ evaluation. There are several things wrong with this idea, however. is unheard of in English, and in other languages (e.g. C++) it is used as a scoping operator, which is a very different beast. In contrast, the single colon for type hints reads naturally -- and no - wonder, since it was carefully designed for this purpose (the idea - long predates :pep:`3107` [gvr-artima]_). It is also used in the same + wonder, since it was carefully designed for this purpose + (`the idea `_ + long predates :pep:`3107`). It is also used in the same fashion in other languages from Pascal to Swift. * What would you do for return type annotations? @@ -2397,8 +2398,8 @@ evaluation. There are several things wrong with this idea, however. Other forms of new syntax ------------------------- -A few other forms of alternative syntax have been proposed, e.g. the -introduction of a ``where`` keyword [roberge]_, and Cobra-inspired +A few other forms of alternative syntax have been proposed, e.g. `the +introduction `_ of a ``where`` keyword, and Cobra-inspired ``requires`` clauses. But these all share a problem with the double colon: they won't work for earlier versions of Python 3. The same would apply to a new ``__future__`` import. @@ -2433,12 +2434,12 @@ problem would that solve? It would just be procrastination. PEP Development Process ======================= -A live draft for this PEP lives on GitHub [github]_. There is also an -issue tracker [issues]_, where much of the technical discussion takes +A live draft for this PEP lives on `GitHub `_. There is also an +`issue tracker `_, where much of the technical discussion takes place. The draft on GitHub is updated regularly in small increments. The -official PEPS repo [peps]_ is (usually) only updated when a new draft +`official PEPS repo `_ is (usually) only updated when a new draft is posted to python-dev. @@ -2457,31 +2458,28 @@ Anders Hejlsberg, Alok Menghrajani, Travis E. Oliphant, Joe Pamer, Raoul-Gabriel Urma, and Julien Verlaguet. -References -========== - -.. [gvr-artima] - http://www.artima.com/weblogs/viewpost.jsp?thread=85551 +.. _gvr-artima: + https://www.artima.com/weblogs/viewpost.jsp?thread=85551 -.. [wiki-variance] - http://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29 +.. _wiki-variance: + https://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29 -.. [typeshed] - https://github.com/python/typeshed/ +.. _typeshed: + https://github.com/python/typeshed -.. [roberge] - http://aroberge.blogspot.com/2015/01/type-hinting-in-python-focus-on.html +.. _roberge: + https://aroberge.blogspot.com/2015/01/type-hinting-in-python-focus-on.html -.. [github] +.. _github: https://github.com/python/typing -.. [issues] +.. _issues: https://github.com/python/typing/issues -.. [peps] +.. _peps: https://hg.python.org/peps/file/tip/pep-0484.txt -.. [importdocs] +.. _importdocs: https://docs.python.org/3/reference/import.html#submodules From 19b273dd0de8e4aec09e4fc08fe0319424808c08 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 9 Jun 2022 10:28:49 +0300 Subject: [PATCH 6/6] PEP 484: Inline the references --- pep-0484.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pep-0484.txt b/pep-0484.txt index 3d75a3352d4..af39a47eda4 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -46,7 +46,7 @@ Essentially, such a type checker acts as a very powerful linter. a similar checker at run time for Design By Contract enforcement or JIT optimization, those tools are not yet as mature.) -The proposal is strongly inspired by mypy [mypy]_. For example, the +The proposal is strongly inspired by `mypy `_. For example, the type "sequence of integers" can be written as ``Sequence[int]``. The square brackets mean that no new syntax needs to be added to the language. The example here uses a custom type ``Sequence``, imported @@ -2458,6 +2458,9 @@ Anders Hejlsberg, Alok Menghrajani, Travis E. Oliphant, Joe Pamer, Raoul-Gabriel Urma, and Julien Verlaguet. +.. _mypy: + http://mypy-lang.org + .. _gvr-artima: https://www.artima.com/weblogs/viewpost.jsp?thread=85551