* Lint: Disable a couple potentially problematic/unneeded hooks
* Lint: Refine regex for existing Content-Type and PEP references checks
* Lint: Refine regex for Python-Version check and fix a couple deviations
* Lint: Refine regex for Created check and fix a couple deviations
* Lint: Refine regex for Resolution check and fix a few deviations
* Lint: Add new check for Post-History header
* Lint: Add check for Discussions-To header link
* Lint: Add basic check for PEP title presense & excessive length
* Lint: Add check for PEP/BDFL-Delegate header
* Lint: Add check for Sponsor header
* Lint: Add check for legacy Author field format
* Lint: Add check for RST Author field
* Lint: Use more helpful, user-oriented descriptions for header checks
* PEP 245: Add historical note and archive links to wiki page/email lsit
* PEP 628: Add direct link to resolution in acceptance message
* Lint: Explictly allow all valid RFC 2822 line continuations in headers
* Lint: Tweak Post-History and Resolution checks to accept fragments
The example in the PEP was incorrect: it does not work since it would require `Comparable` to be defined as a Protocol, which were introduced in a later PEP (PEP 544).
For more info see #1419.
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.
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.
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.
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.
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.
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?
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.