summaryrefslogtreecommitdiffstats
path: root/Demo/classes/Vec.py
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/classes/Vec.py')
-rwxr-xr-xDemo/classes/Vec.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Demo/classes/Vec.py b/Demo/classes/Vec.py
index 56cb839..edb3147 100755
--- a/Demo/classes/Vec.py
+++ b/Demo/classes/Vec.py
@@ -27,17 +27,17 @@ class Vec:
def __add__(self, other):
# Element-wise addition
- v = map(lambda x, y: x+y, self, other)
+ v = list(map(lambda x, y: x+y, self, other))
return Vec().fromlist(v)
def __sub__(self, other):
# Element-wise subtraction
- v = map(lambda x, y: x-y, self, other)
+ v = list(map(lambda x, y: x-y, self, other))
return Vec().fromlist(v)
def __mul__(self, scalar):
# Multiply by scalar
- v = map(lambda x: x*scalar, self.v)
+ v = [x*scalar for x in self.v]
return Vec().fromlist(v)
@@ -45,10 +45,10 @@ class Vec:
def test():
a = vec(1, 2, 3)
b = vec(3, 2, 1)
- print a
- print b
- print a+b
- print a-b
- print a*3.0
+ print(a)
+ print(b)
+ print(a+b)
+ print(a-b)
+ print(a*3.0)
test()