Runtime Data Attributes

code.co_kwonlyargcount

Number of keyword-only parameters, regardless of defaults. The count excludes a variadic keyword parameter.

Formal Syntax & Structure

python syntaxpython
code.co_kwonlyargcount

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=3,**kw): passcode = f.__code__print(code.co_kwonlyargcount)
Python Reference