Skip to content

Conversation

@east825
Copy link
Contributor

@east825 east825 commented Jun 19, 2020

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
Copy link
Contributor Author

east825 commented Jun 19, 2020

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
Copy link
Collaborator

srittau commented Jun 19, 2020

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
Copy link
Contributor Author

east825 commented Jun 19, 2020

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