Allow empty y in new vector
parent
6a4cdaab90
commit
e2e582ab03
|
@ -5,9 +5,9 @@ def vec_or_num(x, y = None):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
class Vector:
|
class Vector:
|
||||||
def __init__(self, x = 0, y = 0):
|
def __init__(self, x = 0, y = None):
|
||||||
self.x = float(x)
|
self.x = float(x)
|
||||||
self.y = float(y)
|
self.y = float(y or x)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "Vector {{x: {0}, y: {1}}}".format(self.x, self.y)
|
return "Vector {{x: {0}, y: {1}}}".format(self.x, self.y)
|
||||||
|
|
Loading…
Reference in New Issue