From 33bf37edce46712a7527871aff2e2325afe5f167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 1 Jul 2019 21:20:40 +0200 Subject: [PATCH] Class --- README.md | 16 ++++++++++++++++ index.html | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/README.md b/README.md index dd3ab86..df42f5e 100644 --- a/README.md +++ b/README.md @@ -902,6 +902,22 @@ class : * **Return value of repr() should be unambiguous and of str() readable.** * **If only repr() is defined, it will also be used for str().** +#### Str() is used by: +```python +print() +f'{}' +raise Exception() +logging.debug() +``` + +#### Repr() is used by: +```python +print([]) +f'{!r}' +>>> +loguru.logger.exception() +``` + ### Constructor Overloading ```python class : diff --git a/index.html b/index.html index 4e784d4..25e5aaa 100644 --- a/index.html +++ b/index.html @@ -855,6 +855,18 @@ creature = Creature(Point(0, Str() is used by: +
print(<el>)
+f'{<el>}'
+raise Exception(<el>)
+logging.debug(<el>)
+
+

Repr() is used by:

+
print([<el>])
+f'{<el>!r}'
+>>> <el>
+loguru.logger.exception()
+

Constructor Overloading

class <name>:
     def __init__(self, a=None):