I am seeing this for the first time. I wanted to know what the !r
in the last line of the code called so that I can search about it. I found this piece of code on: https://adamj.eu/tech/2020/08/10/a-guide-to-python-lambda-functions/
class Puppy:
def __init__(self, name, cuteness):
self.name = name
self.cuteness = cuteness
def __repr__(self):
return f"Puppy({self.name!r}, {self.cuteness!r})"
The "R" name is derived from the first letter of the names of its two developers, Ross Ihaka and Robert Gentleman, who were associated with the University of Auckland at the time.
R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues. R can be considered as a different implementation of S.
R offers a wide variety of statistics-related libraries and provides a favorable environment for statistical computing and design. In addition, the R programming language gets used by many quantitative analysts as a programming tool since it's useful for data importing and cleaning.
\r is a carriage return which often means that the cursor should move to the leftmost column, while \n is a line feed which moves the cursor to the next line.
It's a format string conversion flag that tells the formatter to call repr
on the object before formatting the string.
Three conversion flags are currently supported:
'!s'
which callsstr()
on the value,'!r'
which callsrepr()
and'!a'
which callsascii()
.
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