python-configuration icon indicating copy to clipboard operation
python-configuration copied to clipboard

Bug: repr() is wrong for Configuration subclasses

Open dargueta opened this issue 3 years ago • 0 comments

To reproduce:

env = config.EnvConfiguration(prefix="whatever")
print(repr(env))

The expected output would be something like <EnvConfiguration: 0x123abcdef>, but instead it's always <Configuration: 0x123abcdef>

The fix for this is simple; change Configuration's implementation of __repr__() to:

def __repr__(self) -> str:
    return "<%s: %s>" % (type(self).__name__, hex(id(self)))

dargueta avatar May 25 '22 18:05 dargueta