Skip to content

repr of Color gives wrong property names #154

Description

@tgrajewski

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions