I created my own class my_class
being initiated with two variables, a
and b
.
In case one attempts to create an object of my_class
with a==b
, I would like that object to simply be of type(a)
and not my_class
.
How can this be implemented? How would the following implementation need to be modified?
class myclass:
def __init__(self, a, b):
if a == b:
self = a
else:
myclass.a = a
myclass.b = b