Solution 19.1.
Exercise 19.5
class PointFactory:
def __init__(self):
self._points = {}
def create(self, x, y):
if self._points.has_key((x,y)):
return self._points[(x,y)]
point = Point(x,y)
self._points[(x,y)] = point
return point
def delete(self, x, y):
del self._points[(x,y)]