Skip to content

PEP 646: Update draft#1856

Merged
gvanrossum merged 1 commit intopython:masterfrom
mrahtz:pep-646
Mar 3, 2021
Merged

PEP 646: Update draft#1856
gvanrossum merged 1 commit intopython:masterfrom
mrahtz:pep-646

Conversation

@mrahtz
Copy link
Copy Markdown
Contributor

@mrahtz mrahtz commented Mar 2, 2021

This is the more-or-less final version now. I'll do one last read-through to confirm everything's consistent, then post in typing-sig to confirm it's ready for the Steering Committee.

Semantic changes:

  • Remove support for type variable tuples in Union. Apparently the implementation would be tricky in Pyre because of special-casing around Union. That could be evidence that it would be tricky in Mypy and pytype. Since we don't have a specific use-case in mind, I think this is fine.
  • Support concatenation in Callable. Pradeep pointed ou that ParamSpec doesn't cover all potential use-cases because it doesn't support concatenating suffixes (in turn because ParamSpecs can contain keyword arguments, and concatenation is positional).

Readability changes:

  • Remove the section on a full Array example. We've moved the important thing here - an explicit confirmation that Array can be generic in both datatype and shape - to the beginning of the PEP to make it more obvious. We've removed the Ndim thing after someone pointed out that e.g. Ndim[Literal[2]] would be incompatible with Shape[Any, Any]; I just don't think it's going to work. All that's left is the aliases, which we've moved into the Aliases section itself.

Other changes:

  • Fill out Backwards Compatibility section.
  • Reference initial CPython implementation.

This is the more-or-less final version now. I'll do one last read-through to confirm everything's consistent, then post in typing-sig to confirm it's ready for the Steering Committee.

Semantic changes:
* Remove support for type variable tuples in `Union`. Apparently the implementation would be tricky in Pyre because of special-casing around `Union`. That could be evidence that it would be tricky in Mypy and pytype. Since we don't have a specific use-case in mind, I think this is fine.
* Support concatenation in `Callable`. Pradeep pointed ou that `ParamSpec` doesn't cover all potential use-cases because it doesn't support concatenating suffixes (in turn because `ParamSpec`s can contain keyword arguments, and concatenation is positional).

Readability changes:
* Remove the section on a full `Array` example. We've moved the important thing here - an explicit confirmation that `Array` can be generic in both datatype and shape - to the beginning of the PEP to make it more obvious. We've removed the `Ndim` thing after someone pointed out that e.g. `Ndim[Literal[2]]` would be incompatible with `Shape[Any, Any]`; I just don't think it's going to work. All that's left is the aliases, which we've moved into the Aliases section itself.

Other changes:
* Fill out Backwards Compatibility section.
* Reference initial CPython implementation.
@mrahtz
Copy link
Copy Markdown
Contributor Author

mrahtz commented Mar 2, 2021

@pradeep90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants