File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -837,6 +837,8 @@ class <name>:
837
837
def get_class_name (cls ):
838
838
return cls .__name__
839
839
```
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().**
840
842
841
843
### Constructor Overloading
842
844
``` python
Original file line number Diff line number Diff line change @@ -798,6 +798,10 @@ <h2 id="class"><a href="#class" name="class">#</a>Class</h2>
798
798
< 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 >
799
799
< span class ="hljs-keyword "> return</ span > cls.__name__
800
800
</ 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 >
801
805
< h3 id ="constructoroverloading "> Constructor Overloading</ h3 >
802
806
< pre > < code class ="python language-python hljs "> < span class ="hljs-class "> < span class ="hljs-keyword "> class</ span > << span class ="hljs-title "> name</ span > >:</ span >
803
807
< 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 >
You can’t perform that action at this time.
0 commit comments