.. _consider-alternative-union-syntax:

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:**

.. literalinclude:: /data/messages/c/consider-alternative-union-syntax/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/c/consider-alternative-union-syntax/good.py
   :language: python

**Configuration file:**

.. literalinclude:: /data/messages/c/consider-alternative-union-syntax/pylintrc
    :language: ini





.. note::
  This message is emitted by the optional :ref:`'typing'<pylint.extensions.typing>`
   checker which requires the ``pylint.extensions.typing`` plugin to be loaded.

Created by the `typing <https://github.com/PyCQA/pylint/blob/main/pylint/extensions/typing.py>`__ checker.