.. _confusing-with-statement:

confusing-with-statement / W0124
================================

**Message emitted:**

Following "as" with another context manager looks like a tuple.

**Description:**

*Emitted when a `with` statement component returns multiple values and uses name binding with `as` only for a part of those values, as in with ctx() as a, b. This can be misleading, since it's not clear if the context manager returns a tuple or if the node without a name binding is another context manager.*

**Problematic code:**

.. literalinclude:: /data/messages/c/confusing-with-statement/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/c/confusing-with-statement/good.py
   :language: python



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