I wanna make a init method which can understand these contstrutors.
candy(name="foo", type="bar")
or pass into a whole dict
candy({"name":"foo" , "type":"bar"})
class candy:
def __init__ ?????
How can I make the init method such that accommodate both constructor??
Thanks for help
You can define the init as normal, for example:
and then pass arguments in both ways:
or