diff --git a/rwx/__init__.py b/rwx/__init__.py index ee9f51e..50c7cbe 100644 --- a/rwx/__init__.py +++ b/rwx/__init__.py @@ -2,14 +2,16 @@ __version__ = "0.0.1" +from os import linesep + class Class: """Root class.""" def __repr__(self) -> str: - """Represent object variables. + """Return machine-readable state. - :return: representation + :return: state :rtype: str """ name = self.__class__.__name__ @@ -18,3 +20,14 @@ class Class: ] arguments = ", ".join(attributes) return f"{name}({arguments})" + + def __str__(self) -> str: + """Return human-readable state. + + :return: state + :rtype: str + """ + attributes = [ + f"{k} = {v}" for k, v in vars(self).items() if not k.startswith("_") + ] + return linesep.join(attributes)