consider-alternative-union-syntax / R6003ΒΆ

Message emitted:

Consider using alternative Union syntax instead of '%s'%s


Emitted when 'typing.Union' or 'typing.Optional' is used instead of the alternative Union syntax 'int | None'.

Problematic code:

from typing import Union

cats: Union[int, str]  # [consider-alternative-union-syntax]

Correct code:

cats: int | str

Configuration file:

load-plugins = pylint.extensions.typing


This message is emitted by the optional 'typing' checker, which requires the pylint.extensions.typing plugin to be loaded.

Created by the typing checker.