Fix __mul__

master
WIPocket 3 years ago
parent 887c8cfefd
commit 6a2b181bdd
No known key found for this signature in database
GPG Key ID: 3C8207ED1C3146F8

@ -13,12 +13,12 @@ class Pixel(namedtuple('Pixel', ['r', 'g', 'b'])):
self.b + other.b, self.b + other.b,
) )
def __mul__(self, other): def __mul__(self, other):
if not isinstance(other, int) or not isinstance(other, float): if not isinstance(other, int) and not isinstance(other, float):
raise ValueError('Can only multiply by number') raise ValueError('Can only multiply by number')
return Pixel( return Pixel(
other*pixel.r, other*self.r,
other*pixel.g, other*self.g,
other*pixel.b, other*self.b,
) )
def weighted_average(p1, w1, p2, w2): def weighted_average(p1, w1, p2, w2):

Loading…
Cancel
Save