typing icon indicating copy to clipboard operation
typing copied to clipboard

Python static typing home. Hosts the documentation and a user help forum.

Results 241 typing issues
Sort by recently updated
recently updated
newest added

Some ways to call certain functions are just wrong, and are known to be a bug. For example, [passing type=bool to argparse's add_argument method doesn't work](https://stackoverflow.com/q/15008758). To make type checkers...

topic: feature

I am trying to implement a function that, as the type of one argument, can accept either an Enum or a value of such an enum (because some Python programmers...

topic: feature

I was catching up on a long python-dev discussion about the state of type annotations, and noticed that @gvanrossum had asked for a list of easily discoverable (by search engines)...

topic: documentation

## Problem Currently it's not possible to annotate a function which return a specific module, like: ```python np = load_numpy() # def load_numpy() -> ??: x = np.array(123) # types.ModuleType`...

topic: feature

I found that right now `ParamSpec` allows three kw-only arguments: `bound=None, covariant=False, contravariant=False`. Just like [PEP612](https://www.python.org/dev/peps/pep-0612/) states: > The runtime should accept bounds and covariant and contravariant arguments in the...

topic: other

I've faced limitation of not narrowing types when trying to add types in https://github.com/openai/gym/blob/8e5ae02ab13a89c976ce7b1278c21f755dfa4bd2/gym/spaces/box.py#L33 - (np.isscalar)[https://numpy.org/doc/stable/reference/generated/numpy.isscalar.html] returning False rules out `SupportsFloat` type, and given input type `SupportsFloat | np.ndarray` I...

topic: feature

This issue comes from python/mypy#1237. I'll try to make a summary of the discussion here Some one reported an issue with an artificial example (https://github.com/python/mypy/issues/1237#issue-136162181): ``` python class Foo: def...

topic: feature

I would like to use `ParamSpec` to type a function that accepts a `Callable[P, Any]` and `*args` which will be passed to the callable. The function itself does not accept...

topic: feature

I've been looking through PEP 612 but I just wasn't able to find any way to implement behavior that would allow me to do this: ```py P = ParamSpec("P") R...

topic: feature

This question has already been discussed in #18 long time ago, but now I stumble on this in a practical question: How to annotate something that subclasses two ABC's. Currently,...

topic: feature