Browse Source

Class

pull/33/head
Jure Šorn 5 years ago
parent
commit
a59cb90ff0
2 changed files with 6 additions and 0 deletions
  1. 2
      README.md
  2. 4
      index.html

2
README.md

@ -837,6 +837,8 @@ class <name>:
def get_class_name(cls):
return cls.__name__
```
* **Return value of repr() should be unambiguous and of str() readable.**
* **If only repr() is defined, it will also be used for str().**
### Constructor Overloading
```python

4
index.html

@ -798,6 +798,10 @@ creature = Creature(Point(<span class="hljs-number">0</span>, <span class="hljs
<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>
<span class="hljs-keyword">return</span> cls.__name__
</code></pre>
<ul>
<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>
<h3 id="constructoroverloading">Constructor Overloading</h3>
<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>
<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>

Loading…
Cancel
Save