Polymorphism: Difference between revisions

Content added Content deleted
(Mutable defalt value is evil! all default circles would share same center point. Mutating one circle center will move all.)
Line 737: Line 737:


class Circle(object):
class Circle(object):
def __init__(self, center=Point(), radius=1.0):
def __init__(self, center=None, radius=1.0):
self.center = center
self.center = center or Point()
self.radius = radius
self.radius = radius
def __repr__(self):
def __repr__(self):