Skip to main content

ParameterMode

This enumeration defines the different modes of parameter passing supported by a function or method. It categorizes parameters into types such as positional-only, keyword-only, and various forms of variable arguments, including uniform and unpacked TypedDict keyword arguments.

Attributes

AttributeTypeDescription
PositionalOnly[ParameterMode](parametermode.md?sid=validators_arguments_v3_parametermode)Indicates that the parameter can only be passed by position and cannot be used as a keyword argument.
PositionalOrKeyword[ParameterMode](parametermode.md?sid=validators_arguments_v3_parametermode)Indicates that the parameter can be passed either by position or as a keyword argument.
VarArgs[ParameterMode](parametermode.md?sid=validators_arguments_v3_parametermode)Represents a variable-length positional parameter, typically denoted by *args in Python.
KeywordOnly[ParameterMode](parametermode.md?sid=validators_arguments_v3_parametermode)Indicates that the parameter must be passed as a keyword argument and cannot be passed by position.
VarKwargsUniform[ParameterMode](parametermode.md?sid=validators_arguments_v3_parametermode)Represents a variable-length keyword parameter where all values share a uniform type, typically denoted by **kwargs.
VarKwargsUnpackedTypedDict[ParameterMode](parametermode.md?sid=validators_arguments_v3_parametermode)Represents a variable-length keyword parameter that is unpacked from a TypedDict to provide specific key-value mapping types.

Methods


PositionalOnly()

def PositionalOnly()

Represents a parameter that can only be passed by position, typically used for C-style functions or specific API constraints.


PositionalOrKeyword()

def PositionalOrKeyword()

Represents a standard parameter that can be passed either by its position in the argument list or by its name as a keyword.


VarArgs()

def VarArgs()

Represents a variable-length positional parameter (e.g., *args) used to capture an arbitrary number of positional arguments.


KeywordOnly()

def KeywordOnly()

Represents a parameter that must be passed using its name, preventing accidental positional assignment and improving call-site clarity.


VarKwargsUniform()

def VarKwargsUniform()

Represents a variable-length keyword parameter (e.g., **kwargs) where all captured values are expected to share a uniform type.


VarKwargsUnpackedTypedDict()

def VarKwargsUnpackedTypedDict()

Represents a variable-length keyword parameter that is validated against a specific TypedDict structure for precise keyword argument typing.