typing
typing copied to clipboard
Python static typing home. Hosts the documentation and a user help forum.
Currently incorrect, but useful to be supported: ```python def fun() -> Union[bool, NotImplemented]: ... ``` This will better explain expected, than: ```python def fun() -> Union[bool, Any]: ... ```
These are just some not terribly well though out ideas about possible monkey support in typing. This would need a proper PEP if it was ever implemented, but I just...
I'll just leave this here for potential future consideration as it came up on gitter's typing-dev channel. Typescript has something called [assertion functions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions), which enables the type checker to understand...
For `django-stubs`, we would like to be able to load stubs conditionally, like it's done for typeshed via https://mypy.readthedocs.io/en/latest/common_issues.html#python-version-and-system-platform-checks See https://github.com/typeddjango/django-stubs/issues/262 I'd like to propose to add a special function...
This came up python/typeshed#3521: Currently I can't think of a way to type sentinel values that are often constructed by allowing a certain instance of `object` as the argument. For...
Referenced from https://github.com/python/mypy/issues/7818 We use an Ellipsis as an easy-to-understand, easy-to-import sentinel value to mean "everything else". But it's not possible to use fully with type checking, since mypy doesn't...
Lower bounds are useful when implementing type safe methods of (classes that are covariant with some type) that take argument of some other type. For example, the method [`updated`](https://www.scala-lang.org/api/current/scala/collection/Seq.html#updated[B>:A](index:Int,elem:B):CC[B]) of...
I was trying to create some stubs for lxml library, but I encountered a function that depending on a function object it gets (as in specific function object - checked...
Following on from #424, it would be nice to have something like `AsyncFunction[[Args], ReturnType]` instead of `Callable[[Args], Coroutine[ReturnType]]`.
I am looking for a way to refer to result type of an overloaded function. To illustrate: ```py import typing as tp T = tp.TypeVar("T") @tp.overload def gf1(i: int, j:...