Reading List

!r (a conversion flag) in f-strings. from Ru Singh RSS feed.

!r (a conversion flag) in f-strings.

Celery’s Django docs use a conversion flag within an f-string: Apparently, that calls the instance’s __repr__ method instead of the usual __str__ method. What’s __repr__? RealPython.com writes: The __str__() and __repr__() methods deal with how objects are presented as strings, so you’ll need to make sure you include at least one of those methods in your class definition. If you ... Continue reading →