Skip to content

Instantly share code, notes, and snippets.

@minrk
Created February 3, 2011 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minrk/810125 to your computer and use it in GitHub Desktop.
Save minrk/810125 to your computer and use it in GitHub Desktop.
class Two(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __add__(self, b):
return Sum(self, b)
class Sum(Two):
def __init__(self, a, b):
self.a = a
self.b = b
@property
def x(self):
return self.a.x + self.b.x
@property
def y(self):
return self.a.y + self.b.y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment