|
|
@ -855,6 +855,18 @@ creature = Creature(Point(<span class="hljs-number">0</span>, <span class="hljs |
|
|
|
<li><strong>Return value of repr() should be unambiguous and of str() readable.</strong></li> |
|
|
|
<li><strong>If only repr() is defined, it will also be used for str().</strong></li> |
|
|
|
</ul> |
|
|
|
<h4 id="strisusedby">Str() is used by:</h4> |
|
|
|
<pre><code class="python language-python hljs">print(<el>) |
|
|
|
<span class="hljs-string">f'<span class="hljs-subst">{<el>}</span>'</span> |
|
|
|
<span class="hljs-keyword">raise</span> Exception(<el>) |
|
|
|
logging.debug(<el>) |
|
|
|
</code></pre> |
|
|
|
<h4 id="reprisusedby">Repr() is used by:</h4> |
|
|
|
<pre><code class="python language-python hljs">print([<el>]) |
|
|
|
<span class="hljs-string">f'<span class="hljs-subst">{<el>!r}</span>'</span> |
|
|
|
<span class="hljs-meta">>>> </span><el> |
|
|
|
loguru.logger.exception() |
|
|
|
</code></pre> |
|
|
|
<h3 id="constructoroverloading">Constructor Overloading</h3> |
|
|
|
<pre><code class="python language-python hljs"><span class="hljs-class"><span class="hljs-keyword">class</span> <<span class="hljs-title">name</span>>:</span> |
|
|
|
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, a=None)</span>:</span> |
|
|
|