Remove kwargs from Vector constructor and also simplify getCodeFloat

This commit is contained in:
Eyal Soha committed 2018-07-19 09:43:48 +03:00
1 parent 59a435a787
commit d2bb731bd7
1 file changed
+4 -12
+4 -12
View File
@@ -43,15 +43,9 @@ class Vector3D(object):
True
"""
def __init__(self, *args, **kwargs):
self.x = kwargs.get("x", 0.0)
self.y = kwargs.get("y", 0.0)
self.z = kwargs.get("z", 0.0)
def __init__(self, *args):
if len(args) == 3:
self.x = args[0]
self.y = args[1]
self.z = args[2]
(self.x, self.y, self.z) = args
elif len(args) == 1:
# copy constructor
@@ -504,9 +498,7 @@ def getCodeFloat(line, code):
m = line.find(' ', n)
try:
if m < 0:
val = float(line[n:])
else:
val = float(line[n:m])
return val if not (math.isnan(val) or math.isinf(val)) else None
return float(line[n:])
return float(line[n:m])
except:
return None