summaryrefslogtreecommitdiffstats
path: root/Demo/classes/Vec.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-07-17 20:59:35 (GMT)
committerCollin Winter <collinw@gmail.com>2007-07-17 20:59:35 (GMT)
commit6f2df4d5e193d54244b0c2de91ef0ab1604b9243 (patch)
tree5e172400da7561eb4bb8fafc62c8cab511d74dad /Demo/classes/Vec.py
parenta8c360ee76fb76902a2e2140fbb38d4b06b2d9fb (diff)
downloadcpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.zip
cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.gz
cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.bz2
Run 2to3 over the Demo/ directory to shut up parse errors from 2to3 about lingering print statements.
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()