Repository navigation
Conversation
| ``typing`` is used for type annotations, | ||
| while ``types`` is used to define useful runtime types and primitives. | ||
|
|
||
| Types from ``types`` module are not recognised by a type checker, |
There was a problem hiding this comment.
This isn't always true; a few types in types are useful in annotations (e.g. TracebackType, which is used in __exit__ annotations).
There was a problem hiding this comment.
Oh no 😆
I was not aware of that. Any others?
There was a problem hiding this comment.
I think some people use types.FunctionType? Also I think I've seen types.ModuleType a few times.
There was a problem hiding this comment.
Various types in types are properly typed and recognized by type checkers, such as GeneratorType, MappingProxyType, EllipsisType.
There was a problem hiding this comment.
@ethanhs ok, then we need a new plan. Maybe we can focus on "valid" usecases of using types? Experience from typeshed will totally help! 👍
|
I also don't know that this is a particularly common issue. |
From my experience it is common, people be seeing a module called |
|
related: #11288 |
|
I'm not saying confusion isn't understandable, nor that we shouldn't have documentation addressing this. Just that few users have even heard of |
Citing @erictraut #11286 (comment)
|
Closes #11275