typing
typing copied to clipboard
Python static typing home. Hosts the documentation and a user help forum.
I would like to be able to access the type arguments of a class from its class methods. To make this concrete, here is a generic instance: ```python import typing...
I would find it interesting to be able to annotate functions which never throw exceptions. "Never" can be either in the absolute sense, or in the sense of "checked exceptions",...
is there a way to derive a `Protocol` based type from another class, so all attributes and their type annotations are declared, but may be overriden in the class body....
Sometimes, implementations check for the existence of a method on an object before using it. Take this example from Python 2.7's urllib: ```python class addbase: def __init__(self, fp): self.fp =...
Currently there is no type for the values @property returns. a) the returned value of `property` has no `typing` equivalent ```py def create_property() -> ???: some_really_bad_code = True def setter(value):...
This came up in python/typeshed#2287, but I have encountered the same problem myself. As far as I know, currently the only way to annotate a multi-type, fixed length sequence is...
Sometimes a function or method can return one of several types, depending on the passed in arguments or external factors. Best example is probably `open()`, but there are other examples...
The only form of cast expression we have is intended to completely bypass the type system. This is like most forms of casting in C (not counting conversions) -- it...
I recently stumbled at a TODO in typeshed that proposes to split `IO[AnyStr]` into smaller pieces. I think it is a good idea and propose to add two protocols: ```python...
Due to the lack of character type in Python, a function that accept `List[Text]` will need to be extra careful when generalize the accepted argument type. `Iterable[Text]` and `Sequence[Text]` clearly...