consider-alternative-union-syntax / R6003ΒΆ
Message emitted:
Consider using alternative Union syntax instead of '%s'%s
Description:
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:
[MAIN]
load-plugins = pylint.extensions.typing
Note
This message is emitted by the optional 'typing'
checker, which requires the pylint.extensions.typing
plugin to be loaded.
Created by the typing checker.