How des one properly reject the creation of an object in a Python constructor? Consider an object:
class Triangle:
def __init__(self, a, b, c):
sides = [a, b, c]
sides.sort()
if sides[0]+sides[1] < sides[2]:
return None
self._a = a
self._b = b
self._c = c
If the sides are not logical for a triangle, I would like to reject the creation of a Triangle object. Returning None does not prevent the creation of the Triangle object, and returning False throws an exception. What is the proper way to handle this? Should I throw some type of exception when the wrong parameters are given?