from math import * class Point(): """This class defines a point in 2 space.""" def __init__(self, x, y): """ Pre: x and y are numbers Post: returns a Point with coordinates (x,y) """ self.x = x self.y = y def __str__(self): """Post: returns the string representation of this object""" return "(" + str(self.x) + ", " + str(self.y) + ")" @staticmethod def distance(p1, p2): """ Pre: p1 and p2 are Point objects Post: returns the distance between the two points given """ d = sqrt((p1.x - p2.x)**2 + (p1.y - p2.y)**2 ) return d @classmethod def help(cls): print("--------------------------------------------") print(cls.__name__ + ": " + cls.__doc__) print("--------------------------------------------") for attr in cls.__dict__: if (cls.__dict__[attr].__doc__): print(str(attr) + ": " + cls.__dict__[attr].__doc__) else: print(str(attr))