def __repr__(self):
        "Show all attributes in the signature and any other public attributes that are changed"
        names, parsname, optsname, defaults = self._argspec
        if not defaults: defaults = []
        optnames = names[-len(defaults):] if defaults else []
        optvalues = (getattr(self, name) for name in optnames)
        othernames = sorted(set((n for n in self.__dict__ if n[0] != '_')) - set(names))
        othervalues = list((getattr(self, name, None) for name in othernames))
        otherdefaults = list((getattr(self.__class__, name, None) for name in othernames))
        return "%s.%s(%s)" % (self.__module__, self.__class__.__name__, ", ".join(chain(
            (repr(getattr(self, name)) for name in names[1:len(names)-len(defaults)]),
            ("%s = %r" % (name, value) for name, value, default in zip(optnames, optvalues, defaults) if value != default),
            ("%s = %r" % (name, value) for name, value, default in zip(othernames, othervalues, otherdefaults) if value != default))))
Show all attributes in the signature and any other public attributes that are changed
recipes/Python/578973_Easy_attribute_setting_pretty/recipe-578973.py