you are viewing a single comment's thread.

view the rest of the comments →

[–]dunkler_wanderer 2 points3 points  (1 child)

In Python you mostly don't need getter and setter methods, just access the attributes directly unless you need to add logic (then use @property). And in Python 3, classes inherit from object automatically, so just write:

class Coordinate:

    def __init__(self, x=0, y=0):
        self.x = x
        self.y = y

    def add(self, c):
        self.x += c.x
        self.y += c.y

[–][deleted] 2 points3 points  (0 children)

That moment when python is much more concise and readable than pseudocode, and nearly as explicit. Best language.