I have a method that returns a value object of a class like so:
def get_val_obj():
return SomeValueObject()
I have another method that takes a dictionary and also keyword arguments:
def some_other_method(some_dict, some_other_argument, **kwargs):
"""Do some stuff"""
And finally within the calling method:
some_val_obj_1 = get_val_obj()
some_val_obj_2 = get_val_obj()
some_other_method(some_val_obj_1.__dict__, 'blah', **some_val_obj_2.__dict__)
I saw somewhere that if there is an init method within the Value Object that sets attributes, you can use
.__dict__
to convert a popo. Doesn't work, what do you think is the best approach to my problem? I could just straight up return a dictionary in get_val_obj(), but I'd like to keep it so that it returns a POPO. Is there some other approach entirely that I may be missing? Thanks for the help.