.. _no-self-use:

no-self-use / R6301
===================

**Message emitted:**

Method could be a function

**Description:**

*Used when a method doesn't use its bound instance, and so could be written as a function.*

**Problematic code:**

.. literalinclude:: /data/messages/n/no-self-use/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/n/no-self-use/good.py
   :language: python

**Additional details:**

If a function is not using any class attribute it can be a ``@staticmethod``,
or a function outside the class.



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

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