- def __repr__(self):
- """
- Assumes instance will be found as attribute of own class.
- Returns dot-subscripted path to instance
- (assuming absolute import of containing package)
- """
- cls = type(self)
- for key in dir(cls):
- if getattr(cls, key) is self:
- return "{}.{}.{}".format(cls.__module__, cls.__qualname__, key)
- return repr(self)
\ No newline at end of file