Skip to content

[Feature Request] Support for Var Args and Positional Only Args #1432

@monney

Description

@monney

🚀 Feature Request

Hi Omry!
In a yaml file under the _target_ I'd like the ability to pass things to functions and constructors which accept var args or positional only arguments.

Motivation

Is your feature request related to a problem? Please describe.

Functions like np.random.randn are currently uncallable. Some Objects are unconstructable.

Pitch

Describe the solution you'd like
I'd like to be able to write something like this in a yaml file

positional_only_ob:
  _target_: PositionalOnlyArgs
  args:
    foo: 15 #positional only arg
  bar: 20 # regular arg

for var args the syntax might be something like this:

var_args_ob:
  _target_: VarArgs
  args: #var args
   - 1 
   - 2
   - 3
  bar: 20 # regular arg

Describe alternatives you've considered

  • We could make it so we use _args_ instead of args.
  • We could use a different keyword of kwargs, and pass by position by default.
  • You could always use the proposed positional only args syntax since names will be ignored anyways
  • You could always use the proposed var args syntax (I think)

Are you willing to open a pull request? (See CONTRIBUTING)
Yes

Additional context

I've tried on master (1.1.dev5)

As a side note, this feature is necessary to support instantiation of tuples and sets, but that is a separate feature request I'll likely make once if this becomes supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions