I'm experimenting with OOP python and I wasn't sure about the __repr__ function inheritance. Since the parent class function looked like this:
def __repr__(self):
'''Returns representation of the object'''
return("{}({!r})".format("Class name", self._param))
I wanted to know if it is better to use a generic approach (which could be suitable for children classes as well) like the following one:
def __repr__(self):
'''Returns representation of the object'''
return("{}({!r})".format(self.__class__.__name__, self._param))
or if it is a good practice to override the function in every class.
Also, please ignore the encoding part, since I'm leaving it behind.