I need to instantiate an object using iterable with multiple objects inside. I have to create another method to do it
class MyClass:
def __init__(self, *args):
self.args = args
def instantiate_from_iterable
#some clever code
I need to have a result like this
MyClass.instantiate_from_iterable([1, 5, 3]) == MyClass(1, 5, 3)
MyClass.instantiate_from_iterable((3, 1, 7)) == MyClass(3, 1, 7)
I have no idea how to do this. If someone could help, I would appreciate it very much!
MyClass.__eq__()is undefined, so I'm assuming it'd be implemented asself.args == other.args). For more tips, check out How to ask a good question.