Files
openide/python/python-psi-impl/resources/inspectionDescriptions/PyStringConversionWithoutDunderMethodInspection.html
Morgan Bartholomewandintellij-monorepo-bot cbe872c85a PY-87998 PyStringConversionWithoutDunderMethodInspection: initial
(cherry picked from commit 359b9a41515da9a841aad787695dee4ed14a12f5)

GitOrigin-RevId: 76a2706e3175e2cd8768b2c7882c3506120a82cb
2026-03-24 04:40:40 +00:00

22 lines
617 B
HTML

<html>
<body>
<p>Reports when a type that doesn't define <code>__str__</code>, <code>__repr__</code>, or <code>__format__</code>
is converted to a string. The default string representation may not be useful for debugging or display purposes.</p>
<p><b>Example:</b></p>
<pre><code>
class A:
pass
str(A()) # Result: "&lt;__main__.A object at 0x...&gt;"
</code></pre>
<p>Consider defining one of these methods to provide a meaningful string representation:</p>
<pre><code>
class A:
def __str__(self):
return "A instance"
def __repr__(self):
return "A()"
</code></pre>
</body>
</html>