Skip to content

numeric-literal-too-long (PYI054)#

Derived from the flake8-pyi linter.

Fix is always available.

What it does#

Checks for numeric literals with a string representation longer than ten characters.

Why is this bad?#

If a function has a default value where the literal representation is greater than 50 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on.

Consider replacing such constants with ellipses (...).


def foo(arg: int = 12345678901) -> None:

Use instead:

def foo(arg: int = ...) -> None: