Skip to content

Commit 84dff18

Browse files
committed
Vector accepts dict{x,y,z}
1 parent 828b9bc commit 84dff18

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spockbot/vector.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ def __init__(self, *xyz):
158158
l = len(xyz)
159159
if l == 1:
160160
obj = xyz[0]
161-
xyz = obj.x, obj.y, obj.z
161+
try:
162+
xyz = obj.x, obj.y, obj.z
163+
except AttributeError:
164+
xyz = obj['x'], obj['y'], obj['z']
162165
elif l == 0:
163166
xyz = (0, 0, 0)
164167
elif l != 3:

0 commit comments

Comments
 (0)