Skip to content

Commit da63be9

Browse files
committed
Vector3 accepts tuple/list/... as first argument
1 parent a1d4da6 commit da63be9

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
@@ -161,7 +161,10 @@ def __init__(self, *xyz):
161161
try:
162162
xyz = obj.x, obj.y, obj.z
163163
except AttributeError:
164-
xyz = obj['x'], obj['y'], obj['z']
164+
try:
165+
xyz = obj['x'], obj['y'], obj['z']
166+
except TypeError:
167+
xyz = tuple(obj[:3])
165168
elif l == 0:
166169
xyz = (0, 0, 0)
167170
elif l != 3:

0 commit comments

Comments
 (0)