Skip to content

Instantly share code, notes, and snippets.

@tormaroe
Created February 13, 2019 14:36
Show Gist options
  • Save tormaroe/7c9745d18cdd9da56e83eb9f5bea1f78 to your computer and use it in GitHub Desktop.
Save tormaroe/7c9745d18cdd9da56e83eb9f5bea1f78 to your computer and use it in GitHub Desktop.
Example code Python 2
class Point(object):
def __init__(self, x=0.0, y=0.0):
self.x = x
self.y = y
def __repr__(self):
return '<Point 0x%x x: %f y: %f>' % (id(self), self.x, self.y)
class Circle(object):
def __init__(self, center=None, radius=1.0):
self.center = center or Point()
self.radius = radius
def __repr__(self):
return '<Circle 0x%x x: %f y: %f radius: %f>' % (
id(self), self.center.x, self.center.y, self.radius)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment