String conversion without dunder method
Reports when a type that doesn't define __str__, __repr__, or __format__ is converted to a string. The default string representation may not be useful for debugging or display purposes.
Example:
Consider defining one of these methods to provide a meaningful string representation:
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
PyStringConversionWithoutDunderMethod- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Inspection ID: PyStringConversionWithoutDunderMethodInspection
Inspection options
Here you can find the description of settings available for the String conversion without dunder method inspection, and the reference of their default values.
- Ignored types
Option ID:
ignoredTypesDefault value:
[types.NoneType, _io.TextIOWrapper, str, int, float, complex, set, frozenset, bytes, bytearray, memoryview, slice, list, dict, bool, range, tuple]- Reported types
Option ID:
reportedTypesDefault value:
[types.FunctionType, type]
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: | CLion 2026.1, DataSpell 2026.1, IntelliJ IDEA 2026.1, PyCharm 2026.1, Qodana for JVM 2026.1, |