Skip to content

Commit 33bf37e

Browse files
committed
Class
1 parent 0e9cbd3 commit 33bf37e

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,22 @@ class <name>:
902902
* **Return value of repr() should be unambiguous and of str() readable.**
903903
* **If only repr() is defined, it will also be used for str().**
904904

905+
#### Str() is used by:
906+
```python
907+
print(<el>)
908+
f'{<el>}'
909+
raise Exception(<el>)
910+
logging.debug(<el>)
911+
```
912+
913+
#### Repr() is used by:
914+
```python
915+
print([<el>])
916+
f'{<el>!r}'
917+
>>> <el>
918+
loguru.logger.exception()
919+
```
920+
905921
### Constructor Overloading
906922
```python
907923
class <name>:

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,18 @@ <h2 id="class"><a href="#class" name="class">#</a>Class</h2>
855855
<li><strong>Return value of repr() should be unambiguous and of str() readable.</strong></li>
856856
<li><strong>If only repr() is defined, it will also be used for str().</strong></li>
857857
</ul>
858+
<h4 id="strisusedby">Str() is used by:</h4>
859+
<pre><code class="python language-python hljs">print(&lt;el&gt;)
860+
<span class="hljs-string">f'<span class="hljs-subst">{&lt;el&gt;}</span>'</span>
861+
<span class="hljs-keyword">raise</span> Exception(&lt;el&gt;)
862+
logging.debug(&lt;el&gt;)
863+
</code></pre>
864+
<h4 id="reprisusedby">Repr() is used by:</h4>
865+
<pre><code class="python language-python hljs">print([&lt;el&gt;])
866+
<span class="hljs-string">f'<span class="hljs-subst">{&lt;el&gt;!r}</span>'</span>
867+
<span class="hljs-meta">&gt;&gt;&gt; </span>&lt;el&gt;
868+
loguru.logger.exception()
869+
</code></pre>
858870
<h3 id="constructoroverloading">Constructor Overloading</h3>
859871
<pre><code class="python language-python hljs"><span class="hljs-class"><span class="hljs-keyword">class</span> &lt;<span class="hljs-title">name</span>&gt;:</span>
860872
<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>

0 commit comments

Comments
 (0)