Преглед изворни кода

Modified Point init to accept a tuple of coordinates as well, for easy testing. Should be backwards compatible.

Jayke Meijer пре 14 година
родитељ
комит
c6ab9323ba
1 измењених фајлова са 7 додато и 3 уклоњено
  1. 7 3
      src/Point.py

+ 7 - 3
src/Point.py

@@ -1,4 +1,8 @@
 class Point:
-    def __init__(self, corner):
-        self.x = corner.getAttribute("x")
-        self.y = corner.getAttribute("y")
+    def __init__(self, corner = None, coordinates = None):
+        if corner != None:
+            self.x = corner.getAttribute("x")
+            self.y = corner.getAttribute("y")
+        elif coordinates != None:
+            self.x = coordinates[0]
+            self.y = coordinates[1]