.. _singledispatchmethod-function:

singledispatchmethod-function / E1520
=====================================

**Message emitted:**

``singledispatchmethod decorator should not be used with functions, use singledispatch instead.``

**Description:**

*singledispatchmethod should decorate class/instance methods and not functions. Use singledispatch for those cases.*

**Problematic code:**

.. literalinclude:: /data/messages/s/singledispatchmethod-function/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/s/singledispatchmethod-function/good.py
   :language: python





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