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

repr of Color gives wrong property names

Open tgrajewski opened this issue 7 years ago • 0 comments

The Color.__repr__() method returns a string with long property names 'red', 'green', 'blue' and 'alpha`, while the Color class has properties 'r', 'g', 'b', 'a'.

class Color:
    def __repr__(self):
        return "Color(red={0}, green={1}, blue={2}, alpha={3})".format(self.r, self.g, self.b, self.a)

According to the Python documentation a __repr__() method's return value should look like a valid Python expression that could be used to recreate an object with the same value

tgrajewski avatar Apr 09 '17 22:04 tgrajewski