# Revision history [back]

Inheritance is used when you want to build a class that is a particular case of an existing class (by adding some features). In your case, this looks more like a "mix", hence inheritance seems not very appropriate.

I am not sure i understand your wish clearly, does something along this way makes sense for you ?

class MyObject(SageObject):
def __init__(self, a, b, t):
self.a = a
self.b = b
self.t = t
if t == 0 or t == infinity:
self.I = var('t') == t # self.I takes the value "t == 0" or "t == infinity"
else:
self.I = integral(a**b*e**(-x**2), x, 0, t)


Perhaps could you describe the behaviour you want to see as an example of creation and interaction with the object, so we can help you more.

Inheritance is used when you want to build a class that is a particular case of an existing class (by adding some features). In your case, this looks more like a "mix", hence inheritance seems not very appropriate.

I am not sure i understand your wish clearly, does something along this way makes sense for you ?

class MyObject(SageObject):
def __init__(self, a, b, t):
self.a = a
self.b = b
self.t = t
if t == 0 or t == infinity:
self.I = var('t') == t # self.I takes the value "t == 0" one of the expressions "(t == 0)" or "t == infinity"
"(t == infinity)"
else:
self.I = integral(a**b*e**(-x**2), x, 0, t)


Perhaps could you describe the behaviour you want to see as an example of creation and interaction with the object, so we can help you more.