I usually write a __repr__
as a way to show how the instance can be re-created in the first place. For example:
class Component:
def __init__(self, start, end):
self.start = start
self.end = end
def __repr__(self):
return f'{self.__class__.__name__}(start={self.start}, end={self.end})'
Is there a 'standard' way to write the __repr__
, if not, are there suggested options/best-practices for how this should be written, or it's totally subjective?