Commit Graph

88 Commits

Author SHA1 Message Date
Jelle Zijlstra eb6282b4a7 Change specification for `# type: ignore` (#1072)
As discussed on the typing-sig mailing list, the currently specified behavior for `# type: ignore` on a line by itself has remained mostly unimplemented and doesn't seem useful. Instead, the PEP now mandates a syntax for ignoring all errors in a specific file, which is more obviously useful.

I considered adding a sentence like "Individual type checkers may add additional syntax for silencing errors", but it didn't seem particularly useful since type checkers in general are free to add extensions to what PEP 484 specifies.

While I was at it I added a reference to PEP 526 to an out-of-date sentence adjacent to the modified paragraph.
2019-05-22 08:22:39 -07:00
Sebastian Rittau 696664643d PEP 484: Add @type_check_only (#858)
Per discussion in python/typing#597.
2019-04-12 15:31:37 -07:00
Sebastian Rittau cd1efca559 PEP 484: Remove mention of typing.io and .re (#821) 2018-10-29 16:36:42 +00:00
Jelle Zijlstra 18b3312574 PEP 484: Clarify definition of AnyStr (#744)
The definition of AnyStr as given makes sense only in Python 3, as observed by @srittau. To prevent confusion, this PR changes the definition to use Text instead of str.

I also changed the two places where AnyStr was defined as an example, and made a few other related adjustments:
- Remove mention of None as modifying the type, which is not true as of #689.
- Move Text up in the list of convenience definition because we now need it for the definition of AnyStr.
- Modify definition of Optional to use `None` instead of `type(None)`, because the latter is not a valid static type.
2018-09-12 11:48:04 -07:00
Jelle Zijlstra 0630155b47 PEP 484: Do not require type checkers to treat a None default specially (#689)
Following discussion in python/typing#275, there is a consensus that it is better to require optional types to be made explicit. This PR changes the wording of PEP 484 to encourage
type checkers to treat a None default as implicitly making an argument Optional.
2018-07-09 21:22:44 -07:00
Nick Coghlan 307dda38d4
PEP 1: Add a separate "Provisional" PEP status (#577)
This adds an explicit "Provisional" status for PEPs, making
it easier to track which PEPs are truly Final, and which
are pending further further public feedback based on
their initially published reference implementations.
2018-07-08 11:50:57 +10:00
Guido van Rossum bb9ca321dc Accept PEP 561 and link to it from the relevant section in PEP 484 2018-06-27 16:19:14 -07:00
Jelle Zijlstra 26926a0ba8 Arguments that end with `__` are not positional-only (#670)
This came up in python/mypy#5156; we agreed that it was an oversight in the original specification of this feature to not allow this.
2018-06-06 17:01:24 +01:00
Mariatta 941b0580b3
PEP 484: Fix a typo in code example (GH-591) 2018-03-13 09:43:20 -07:00
Davydenko Myroslav 5920dc1117 PEP 484: Fix the example code (GH-583) 2018-03-03 13:19:13 -08:00
Davydenko Myroslav 2d317ff215 Fix syntax error (#582) 2018-02-28 05:36:10 +11:00
Łukasz Langa cea4966702 lukasz@langa.pl -> lukasz@python.org 2018-01-27 13:19:45 -08:00
Ivan Levkivskyi a81f56f751 Add coding style recommendations for variable annotations (#548) 2018-01-18 19:33:13 -08:00
Guido van Rossum e7fea64f2b
Add links to PEP 563. (#451)
Mention an updated schedule for non-provisional status and the end of
non-typing annotations in PEP 563, and link there for the __future__
statement as well.
2017-12-04 08:46:27 -08:00
Ethan Smith e4b790c194 Add suggestion about multiple comment syntax (#476)
Describing the status quo.
2017-11-17 15:49:25 -08:00
Mariatta cf3bad5ab3
Revert "Rename all .txt PEP files to .rst (GH-462)" (GH-464)
This reverts commit bb0e518ed3.
2017-11-11 11:28:55 -08:00
Huang Huang bb0e518ed3 Rename all .txt PEP files to .rst (GH-462)
For https://github.com/python/peps/issues/1
2017-11-11 10:30:43 -08:00
Iustin Pop 29e825f0c2 A few wording fixed to pep-0484 (#339) 2017-09-12 16:29:16 -07:00
Ethan Smith ee64ced217 PEP 484: Clarify Python versioning in stub file search path (#410) 2017-09-09 20:56:06 -07:00
Matthias Kramm 1a92d6ea0d PEP 484: Remove statement about unicode, in the python2.7 section. (#302)
See https://github.com/python/typing/issues/418#issuecomment-313753006.
Let's leave it up to type-checkers whether they want `unicode`, in Python 2
code, to mean "only unicode" or "str or unicode".
2017-07-18 13:59:39 -07:00
Jelle Zijlstra 7221386f27 PEP 484: Clarify that submodules in a package are exported (#309)
See discussion in https://github.com/python/typeshed/pull/1484#discussion_r127114355.
2017-07-17 15:51:21 -07:00
Ivan Levkivskyi 25b7a873f8 Allow deriving NewType from another unique type (#271)
See discussion in python/mypy#3465
2017-05-30 09:56:56 -07:00
Max 534c911d7a Update generic class attribute and type variable usage (#239)
See https://github.com/python/mypy/issues/2878
2017-05-10 20:54:35 -07:00
Jelle Zijlstra a7e294d3b4 PEP 484: Add implicit promotions for Python 2.7 (#245)
This was discussed in https://github.com/python/typeshed/issues/270#issuecomment-296411726. Both mypy and pytype behave as described already. We should document this behavior in the PEP to make sure people are aware of it and promote uniformity.

Mypy also implicitly promotes bytearray to bytes in both Python 2 and 3. Not sure if that's worth codifying in the PEP too.

@vlasovskikh Is this also OK for PyCharm?
2017-04-24 08:24:24 -07:00
Ivan Levkivskyi 257e909cae PEP 484: Clarify scoping of type variables (#231) 2017-03-24 08:35:10 -07:00
Ivan Levkivskyi 881c6bebdb PEP 484: Add NoReturn type (#218)
As discussed in python/typing#165.
2017-03-17 13:46:55 -07:00
Ivan Levkivskyi ccae12b0ba PEP 484: Clarify type erasure and instantiation of concrete collections (#193)
Fixes python/typing#367
2017-01-31 16:27:53 -08:00
Ivan Levkivskyi 07aa25d192 PEP 484: add an example of iterable unpacking with type comments (#190)
Fixes python/typing#363
2017-01-27 14:29:16 -08:00
Mariatta f67dd4a759 Remove extra backticks (#184) 2017-01-19 10:00:52 -08:00
Nick Nystrom 7bdfb0006d Spelling (gneric > generic) (#178) 2017-01-11 09:18:56 +11:00
Naomi Seyfer 26b4086667 Document `__foo` syntax for positional-only args (#147) 2016-12-03 16:02:52 -08:00
Naomi Seyfer 22d8c63e03 Fix transposed letters in `agrument` (#146) 2016-12-02 17:16:35 +11:00
Ivan Levkivskyi 6a74c9ebaf PEP 484: Add a note that misplaced type comments are errors for typecheckers (#133)
Fixes python/typing#210.

This behaviour with --fast-parser is in mypy since mid-May. It looks like nobody is complaining.
2016-11-06 10:54:51 -08:00
Ivan Levkivskyi ada7d3566e PEP 484: Allow annotating first argument of instance and class methods (#89) 2016-11-01 08:15:17 -07:00
Ivan Levkivskyi a1cd7fb7c8 Clarify per-argument type comments in PEP 484 (#126) 2016-11-01 08:12:17 -07:00
Ivan Levkivskyi bf827dc23d [WIP] Add Coroutine ABC to PEP 484 (#125)
* Simpler example for Coroutine
2016-11-01 08:07:53 -07:00
Ivan Levkivskyi d309d32728 Soften restriction for runtime generics in PEP 484 (#120)
Fixes https://github.com/python/typing/issues/303.

See also https://github.com/python/mypy/pull/2302 (which removes the restriction from mypy).

As a motivation, in Python one always can substitute expressions, so that if ``IntNode = Node[int]; IntNode()`` works, then it is reasonable to also allow ``Node[int]``, but say that the first way is preferred.
2016-10-24 10:29:40 -07:00
Guido van Rossum 2ec55d541d Change "iff" -> "if" in example docstrings. 2016-10-20 21:35:42 -07:00
Ivan Levkivskyi 68ef9a665b Update the type alias example in PEP 484 (#118) 2016-10-18 08:07:44 -07:00
Ivan Levkivskyi 0f5e998985 Tweak the scope of type: ignore comment (#114)
Fixes python/typing#292
2016-10-10 13:20:42 -07:00
Ivan Levkivskyi c1dc44b21f Updates for PEPs 484 and 483 (#111) 2016-09-30 16:25:26 -07:00
Ivan Levkivskyi 5f30d8f81a Clarify meaning of bare Tuple, etc. (#110)
Fixes python/typing#284
2016-09-27 08:34:50 -07:00
Ivan Levkivskyi a919235364 [WIP] Semantics of variance in type variables and notation conventions (#68)
* Semantics of variance in type variables and notation conventions

* Notation convention for type variables in PEP 8
2016-08-03 11:33:00 -07:00
Ivan Levkivskyi 78478bc886 Add scoping rules for type variables to PEP 484 (#63)
Also clarify the description of NewType() a bit.

Fixes python/typing#249
2016-07-29 16:53:04 -07:00
Marti Raudsepp 04a6af2ab1 Fix various typos, spelling and grammar errors
Errors detected using Topy (https://github.com/intgr/topy), all changes
verified by hand.
2016-07-11 18:35:35 +03:00
Guido van Rossum bf22a02332 Add explanation of singletons in unions to PEP484
By Ivan Levkivskyi (https://github.com/python/typing/pull/240).
2016-07-05 09:35:49 -07:00
Guido van Rossum 75be7047af Add typing.TYPE_CHECKING to PEP 484. 2016-06-08 11:13:41 -07:00
Guido van Rossum 02a9d6de10 The type of an empty tuple is spelled Tuple[()]. Fixes upstream #231. 2016-06-06 13:43:37 -07:00
Guido van Rossum 2ec3031a74 Fix an indentation error in the rST for NewType (Ryan Gonzalez). 2016-06-06 08:49:12 -07:00
Guido van Rossum 7596c54962 Add NewType() to PEP 484. 2016-06-01 18:02:33 -07:00