Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Type checking for *args and **kwargs when passing them to another function #2036

Open
Labels
topic: featureDiscussions about new features for Python's type annotations
@t1m013y

Description

@t1m013y

Problem:

I am writing a python application, and I made a function that creates an object and passes its additional*args and**kwargs to object's constructor and takes few its own arguments. I want to make*args and**kwargs typed exactly as inner function's arguments.

Description and examples:

A simple example with two functions:

definner(a:int,b:int)->None:    ...defwrapper(arg1:str,*args,**kwargs)->None:inner(*args,**kwargs)# It will automatically detect passing arguments to another function

In my case,inner is object constructor, I gave an example with functions to make it more simple.

Type checkers should seewrapper's signature like this:

defwrapper(arg1:str,a:int,b:int):    ...

It may be enabled by default when passing*args and**kwargs to another function is detected or it may be enabled by adding a decorator to the function.

Detailed description:

Already suggested this to mypy, detailed description of this feature can be found here:python/mypy#19302.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: featureDiscussions about new features for Python's type annotations

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp