Skip to content

ambiguous-variable-name

Pythonstyleno fixdefault: off

Reports a variable, parameter or global name that is l, O or I.

In many fonts l (lower case L), I (upper case i) and the digit 1 look alike, and so do O and 0. In l = O + 1 a reader cannot tell the names from the numbers.

To fix, rename the variable.

Reported
...
def g(l: "int", O=1, *I):
l = 1
...
python:
lint:
rules:
ambiguous-variable-name: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line ambiguous-variable-name in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff E741 full