Skip to content

Possible way to type hint callbacks #144

Open
@matperc

Description

@matperc

Right now we hint all the callables that admits variable arguments as Callable[..., T]. Starting from python 3.10 we can use the combination of Concatenate and ParamSpec. Link to documentation.

So for example GAsyncReadyCallback can be typed as

__P__ = ParamSpec("__P__")

Callable[Concatenate[GObject.Object, Gio.AsyncResult, __P__], None]

@lovetox there are any plans to support 3.10?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions