smartcall.PosOnly

class smartcall.PosOnly(value: Any, *, required: bool = False)[source]

A value that must be passed as a positional argument.

Parameters:
  • value – The value to pass to the function.

  • required – What to do when passing this argument to a function with an incompatible signature. If True, raise an error. If False (the default), ignore it.

Example

>>> from smartcall import PosOnly, call
>>> def f(a):
...     return a
...
>>> call(f, PosOnly(1))
1