How to implement __format__ in your own classes to render your objects based on format specifications.

How do f-string format specifications (mini language) work and how can you use this in your classes?

In this video you learn how f-strings use __format__ in classes, how formatting specs like align, round work and how you can implement __format__ in your own classes to render your objects based on format specifications, passed in the f-string placeholder.

Written by Loek van den Ouweland on 2022-01-24.
Questions regarding this artice? You can send them to the address below.