Skip to content

Add PEP 613 TypeAlias stub to typing_extensions#4243

Merged
srittau merged 2 commits into
python:masterfrom
east825:PEP-613_typing_extensions.TypeAlias
Jun 19, 2020
Merged

Add PEP 613 TypeAlias stub to typing_extensions#4243
srittau merged 2 commits into
python:masterfrom
east825:PEP-613_typing_extensions.TypeAlias

Conversation

@east825

@east825 east825 commented Jun 19, 2020

Copy link
Copy Markdown
Contributor

At the moment this special marker annotation described in
PEP 613 exists only in typing_extensions module
(see python/typing#732).

At the moment this special marker annotation described in
PEP 613 exists only in typing_extensions module
(see python/typing#732).
@east825

east825 commented Jun 19, 2020

Copy link
Copy Markdown
Contributor Author

BTW, what's the difference between declarations such as

Any = object()
TypedDict: object

(in typing.pyi)

and

TypedDict: object = ...

(in typing_extensions.pyi)

These are considered equivalent, aren't they? Which one is preferred then?

@srittau

srittau commented Jun 19, 2020

Copy link
Copy Markdown
Collaborator

Foo: object is the preferred form. The = ... is redundant. Any = object() doesn't make much sense in stubs. The reason that type checkers don't complain is that typing.pyi is usually special-cased by them.

@east825

east825 commented Jun 19, 2020

Copy link
Copy Markdown
Contributor Author

Ok, thanks! I'll drop "= ..." part in my PR then.

@srittau srittau merged commit 30bbf02 into python:master Jun 19, 2020
vishalkuo pushed a commit to vishalkuo/typeshed that referenced this pull request Jun 26, 2020
@east825 east825 deleted the PEP-613_typing_extensions.TypeAlias branch October 7, 2020 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants