Skip to content

Files

Latest commit

 

History

History
28 lines (18 loc) · 541 Bytes

positional-only-arguments-expected.md

File metadata and controls

28 lines (18 loc) · 541 Bytes

Pattern: Misuse of positional-only arguments

Issue: -

Description

Emitted when positional-only arguments have been passed as keyword arguments. Remove the keywords for the affected arguments in the function call.

Example of incorrect code:

def cube(n, /):
    """Takes in a number n, returns the cube of n"""
    return n**3

cube(n=2) # [positional-only-arguments-expected]

Example of correct code:

def cube(n, /):
    """Takes in a number n, returns the cube of n"""
    return n**3

cube(2)