DEV Community

Discussion on: Python: update a dict by object

Collapse
 
mxl profile image
Maria Boldyreva

Hi. In general case, your solution is better and cleaner than mine. I was so excited to have found the solution (it was a work task) that I forgot to mention, that the object is a huge legacy object and I needed just a few of its attributes and .update(obj) is a legacy line I have no control over. I'll update the post soon, thanks for the comment.

Collapse
 
rhymes profile image
rhymes

Ahah you see, then your solution is more apt than mine ;-)

I just gave you two other options that are useful in case you cannot modify the source code of the class.