.. _prefer-typing-namedtuple: prefer-typing-namedtuple / R6105 ================================ **Message emitted:** ``Prefer 'typing.NamedTuple' over 'collections.namedtuple'`` **Description:** *'typing.NamedTuple' uses the well-known 'class' keyword with type-hints for readability (it's also faster as it avoids an internal exec call). Disabled by default!* .. caution:: This message is disabled by default. To enable it, add ``prefer-typing-namedtuple`` to the ``enable`` option. **Problematic code:** .. literalinclude:: /data/messages/p/prefer-typing-namedtuple/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/p/prefer-typing-namedtuple/good.py :language: python **Configuration file:** .. literalinclude:: /data/messages/p/prefer-typing-namedtuple/pylintrc :language: ini **Related links:** - `typing.NamedTuple `_ .. note:: This message is emitted by the optional :ref:`'code_style'` checker, which requires the ``pylint.extensions.code_style`` plugin to be loaded. Created by the `code_style `__ checker.