class Link:
def __repr__(self):
if self.rest is not Link.empty:
rest_repr = ', ' + repr(self.rest)
else:
rest_repr = ''
return 'Link(' + repr(self.first) + rest_repr + ')'
I wonder :Is the repr
function a built-in funciton in Python even though I am defining the __repr__ function?
Answer: the repr() is a bulit-in function. we can use the repr()
in the __repr__
function