Skip to content

Commit a59cb90

Browse files
committed
Class
1 parent 6b84006 commit a59cb90

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,8 @@ class <name>:
837837
def get_class_name(cls):
838838
return cls.__name__
839839
```
840+
* **Return value of repr() should be unambiguous and of str() readable.**
841+
* **If only repr() is defined, it will also be used for str().**
840842

841843
### Constructor Overloading
842844
```python

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,10 @@ <h2 id="class"><a href="#class" name="class">#</a>Class</h2>
798798
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_class_name</span><span class="hljs-params">(cls)</span>:</span>
799799
<span class="hljs-keyword">return</span> cls.__name__
800800
</code></pre>
801+
<ul>
802+
<li><strong>Return value of repr() should be unambiguous and of str() readable.</strong></li>
803+
<li><strong>If only repr() is defined, it will also be used for str().</strong></li>
804+
</ul>
801805
<h3 id="constructoroverloading">Constructor Overloading</h3>
802806
<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>
803807
<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)