Runtime Data Attributes

code.co_posonlyargcount

Number of positional-only parameters, a subset of co_argcount. Introduced with Python 3.8 positional-only syntax.

Formal Syntax & Structure

python syntaxpython
code.co_posonlyargcount

Return Value

int

Value exposed by this attribute; availability and mutability depend on the owner as described.

Working Example

Example Snippetpython
def f(a,b,/,c): passcode = f.__code__print(code.co_posonlyargcount)
Python Reference