Skip to content
murmot

Results for “python function reference type example error site:typing.python.org 1”

  • typing.python.org

    Type aliases — typing documentation

    type statement ¶ Type aliases may also be defined using the type statement (Python 3.12 and higher). The type statement allows the creation of explicitly generic type aliases: ... Type parameters declared as part of a generic type alias are valid only when evaluating the right-hand side of the type alias.

  • typing.python.org

    Overloads — typing documentation

    @overload decorator allows describing functions and methods that support multiple different combinations of argument types. This pattern is used frequently in ...

  • typing.python.org

    Generics — typing documentation

    In Python 3.12 and newer, a parameter specification variable can be introduced inline by prefixing its name with ** inside a type parameter list (for a function, class, or type alias).

  • typing.python.org

    Callables — typing documentation

    Specification for the Python type system »; Callables. |; Theme. Auto ... function that has **kwargs annotated with Unpack must generate a type checker error.

  • typing.python.org

    Type annotations — typing documentation

    String annotations ¶ When a type hint cannot be evaluated at runtime, that definition may be expressed as a string literal, to be resolved later. The string literal should contain a syntactically valid Python expression (i.e., compile (lit, '', 'eval') should succeed) that is a valid annotation expression.

  • typing.python.org

    typing.python.org

    This states that the expected type of the ``name`` argument is ``str``. Analogically, the expected return type is ``str``. Expressions whose type is :term:`assignable` to a specific argument type are also accepted for that argument. Similarly, an expression whose type is assignable to the annotated return type can be returned from the function. .. _`missing-annotations`:

  • typing.python.org

    Class type assignability — typing documentation

    Type annotations can be used to annotate class and instance variables in class bodies and methods. In particular, the value-less notation a: int allows one to annotate instance variables that should be initialized in __init__ or __new__.