.. _unnecessary-ellipsis:

unnecessary-ellipsis / W2301
============================

**Message emitted:**

Unnecessary ellipsis constant

**Description:**

*Used when the ellipsis constant is encountered and can be avoided. A line of code consisting of an ellipsis is unnecessary if there is a docstring on the preceding line or if there is a statement in the same scope.*

**Problematic code:**

.. literalinclude:: /data/messages/u/unnecessary-ellipsis/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/u/unnecessary-ellipsis/good.py
   :language: python



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