Skip to content

Commit d237d07

Browse files
committed
Format, Decorator, Class
1 parent d054bfe commit d237d07

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ Format
338338
```
339339

340340
### String Options
341-
**`'!r'` calls object's repr() method, instead of format(), to get a string.**
342341
```python
343342
{'abcde'!r:<10} # "'abcde' "
344343
```
344+
* **`'!r'` calls object's repr() method, instead of format(), to get a string.**
345345

346346
```python
347347
{'abcde':.3} # 'abc'
@@ -608,7 +608,7 @@ def function_that_gets_passed_to_decorator():
608608
```
609609

610610
### Debugger Example
611-
**Decorator that prints function's name every time it gets called. Wraps is a helper decorator that copies metadata of function add() to function out(). Without it `'add.__name__'` would return `'out'`.**
611+
**Decorator that prints function's name every time it gets called.**
612612

613613
```python
614614
from functools import wraps
@@ -624,6 +624,8 @@ def debug(func):
624624
def add(x, y):
625625
return x + y
626626
```
627+
* **Wraps is a helper decorator that copies metadata of function add() to function out().**
628+
* **Without it `'add.__name__'` would return `'out'`.**
627629

628630
### LRU Cache
629631
**Decorator that caches function's return values. All arguments must be hashable.**
@@ -714,7 +716,9 @@ class MyComparable:
714716
```
715717

716718
### Hashable
717-
**Hashable object needs both hash() and eq() methods and it's hash value should never change. Objects that compare equal must have the same hash value, meaning default hash() that returns `'id(self)'` will not do. That is why Python automatically makes classes unhashable if you only implement eq().**
719+
* **Hashable object needs both hash() and eq() methods and it's hash value should never change.**
720+
* **Objects that compare equal must have the same hash value, meaning default hash() that returns `'id(self)'` will not do.**
721+
* **That is why Python automatically makes classes unhashable if you only implement eq().**
718722

719723
```python
720724
class MyHashable:

0 commit comments

Comments
 (0)