Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> >>> p = Point(3,4) >>> p.x 3 >>> p.y 4 >>> p.z Traceback (most recent call last): File "", line 1, in p.z AttributeError: 'Point' object has no attribute 'z' >>> print(p) <__main__.Point object at 0x00EC3B90> >>> ================================ RESTART ================================ >>> >>> p = Point(3,4) >>> p Traceback (most recent call last): File "", line 1, in p File "C:\Python33\lib\idlelib\rpc.py", line 614, in displayhook text = repr(value) File "C:\Documents and Settings\eladlibm\Desktop\OOP_geometry.py", line 9, in __repr__ return "Point(" + str(x) + "," + str(y) + ")" NameError: global name 'x' is not defined >>> ================================ RESTART ================================ >>> >>> p = Point(3,4) >>> p Point(3,4) >>> ================================ RESTART ================================ >>> >>> p = Point(3,"4") Traceback (most recent call last): File "", line 1, in p = Point(3,"4") File "C:\Documents and Settings\eladlibm\Desktop\OOP_geometry.py", line 5, in __init__ assert isinstance(x,(int, float)) and isinstance(y,(int, float)) AssertionError >>> ================================ RESTART ================================ >>> >>> p = Point(3,4) >>> p.is_origin() False >>> Point.is_origin(p) False >>> p.__repr__() 'Point(3,4)' >>> ================================ RESTART ================================ >>> >>> p1==p2 False >>> p1==p3 #no __eq__ here False >>> ================================ RESTART ================================ >>> >>> p1 Point(3,4) >>> p2 Point(0,0) >>> p3 Point(3,4) >>> p1==p3 True #now we have __eq__ >>> p1>> p2>> p2<=p3 Traceback (most recent call last): File "", line 1, in p2<=p3 TypeError: unorderable types: Point() <= Point() >>> p2>p3 #although no __gt__ for p1, python tries p3's __lt__ False >>> p1+p3 Point(6,8) >>> p1 Point(3,4) >>> p3 Point(3,4) >>> p1+7 Point(10,11) >>> ================================ RESTART ================================ >>> >>> p1+7 #here I removed __add__ Traceback (most recent call last): File "", line 1, in p1+7 TypeError: unsupported operand type(s) for +: 'Point' and 'int' >>> p1.add(7) Point(10,11) >>> p1.add(Point(9,-3)) Point(12,1) >>> p1 Point(3,4) >>> type(p1) >>> p1.increment(p3) >>> p1 Point(6,8) >>> p3 Point(3,4) >>> p3.increment(77) >>> p3 Point(80,81) >>> p1+=2 Traceback (most recent call last): File "", line 1, in p1+=2 TypeError: unsupported operand type(s) for +=: 'Point' and 'int' >>> p1.isExtreme(p2,p3, Point(9,8), Point()) False >>> p1.isExtreme([p2,p3, Point(9,8), Point()]) Traceback (most recent call last): File "", line 1, in p1.isExtreme([p2,p3, Point(9,8), Point()]) File "C:\Documents and Settings\eladlibm\Desktop\OOP_geometry.py", line 59, in isExtreme if (not point < self): TypeError: unorderable types: list() < Point() >>> p4 = Point(9,8) >>> p4 Point(9,8) >>> r = Rectangle1(p1, Point(5,6)) Traceback (most recent call last): File "", line 1, in r = Rectangle1(p1, Point(5,6)) File "C:\Documents and Settings\eladlibm\Desktop\OOP_geometry.py", line 85, in __init__ assert lower_left_vertex < upper_right_vertex AssertionError >>> p1 Point(6,8) >>> r = Rectangle1(p1, Point(7,8)) Traceback (most recent call last): File "", line 1, in r = Rectangle1(p1, Point(7,8)) File "C:\Documents and Settings\eladlibm\Desktop\OOP_geometry.py", line 85, in __init__ assert lower_left_vertex < upper_right_vertex AssertionError >>> r = Rectangle1(p1, Point(7,9)) >>> r Rectangle with lower left Point(6,8) and upper right Point(7,9) >>>