Skip to content

Commit 5a3fc5f

Browse files
committed
Add notebook that illustrates __format__
1 parent 5b36472 commit 5a3fc5f

File tree

2 files changed

+405
-0
lines changed

2 files changed

+405
-0
lines changed

source-code/object-orientation/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ Some examples of object-oriented programming in Python.
2020
of multiple inheritance in Python.
2121
* `mix-ins`: illustration of mix-ins.
2222
* `attr_intro.ipynb`: illustration of how to use the `attrs` package.
23+
* `f_string_user_defined_formats.ipynb`: illustration of how to use
24+
f-strings with user-defined classes by overriding the `__format__`
25+
method. It also illustrates the use of `__new__` to create
26+
instances of a class while checking for validity of the arguments.

0 commit comments

Comments
 (0)