projects
/
linpy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5e2869e
)
Return NotImplemented in Point special methods
author
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Tue, 19 Aug 2014 12:58:23 +0000
(14:58 +0200)
committer
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Tue, 19 Aug 2014 12:58:23 +0000
(14:58 +0200)
linpy/geometry.py
patch
|
blob
|
history
diff --git
a/linpy/geometry.py
b/linpy/geometry.py
index
5b5ed89
..
a0a7b7c
100644
(file)
--- a/
linpy/geometry.py
+++ b/
linpy/geometry.py
@@
-185,10
+185,10
@@
class Point(Coordinates, GeometricObject):
"""
Translate the point by a Vector object and return the resulting point.
"""
"""
Translate the point by a Vector object and return the resulting point.
"""
- if
not
isinstance(other, Vector):
- return NotImplemented
-
coordinates = self._map2(other, operator.add
)
- return
Point(coordinates)
+ if isinstance(other, Vector):
+ coordinates = self._map2(other, operator.add)
+
return Point(coordinates
)
+ return
NotImplemented
def __sub__(self, other):
"""
def __sub__(self, other):
"""
@@
-203,15
+203,15
@@
class Point(Coordinates, GeometricObject):
elif isinstance(other, Vector):
coordinates = self._map2(other, operator.sub)
return Point(coordinates)
elif isinstance(other, Vector):
coordinates = self._map2(other, operator.sub)
return Point(coordinates)
- else:
- return NotImplemented
+ return NotImplemented
def __eq__(self, other):
"""
Test whether two points are equal.
"""
def __eq__(self, other):
"""
Test whether two points are equal.
"""
- return isinstance(other, Point) and \
- self._coordinates == other._coordinates
+ if isinstance(other, Point):
+ return self._coordinates == other._coordinates
+ return NotImplemented
def aspolyhedron(self):
from .polyhedra import Polyhedron
def aspolyhedron(self):
from .polyhedra import Polyhedron