.. _typevar-double-variance:

typevar-double-variance / C0131
===============================

**Message emitted:**

TypeVar cannot be both covariant and contravariant

**Description:**

*Emitted when both the "covariant" and "contravariant" keyword arguments are set to "True" in a TypeVar.*

**Problematic code:**

.. literalinclude:: /data/messages/t/typevar-double-variance/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/t/typevar-double-variance/good.py
   :language: python



Created by the `basic <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/base/name_checker/checker.py>`__ checker.