I get what the new f strings in python 3.6 do, but what about the ending !r as found in the code snip below.
def __repr__(self):     return (f'Pizza({self.radius!r}, 'f'{self.ingredients!r})') 
                f-strings include a directive that allows the repr of a Python object to be included in the final output. The repr of a Python object is a debugging description of the given Python object.
In Python, when you prefix a string with the letter r or R such as r'...' and R'...' , that string becomes a raw string. Unlike a regular string, a raw string treats the backslashes ( \ ) as literal characters.
The r prefix on strings stands for “raw strings”. Standard strings use backslash for escape characters: “\n” is a newline, not backslash-n.
It just calls the repr of the value supplied. It's usage is generally not really needed with f-strings since with them you can just do repr(self.
It just calls the repr of the value supplied. 
It's usage is generally not really needed with f-strings since with them you can just do repr(self.radius) which is arguably more clear in its intent.
!r (repr), !s (str) and !a (ascii) were kept around just to ease compatibility with the str.format alternative, you don't need to use them with f-strings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With