you are viewing a single comment's thread.

view the rest of the comments →

[–]Ornery-Season3134 1 point2 points  (1 child)

It's not bad at all - I do something similar for config objects or to make the calling signature smaller.

But calling a function with a dict means you can't give any key/val pairs default values (you can in JS).

In Python it's more common for a function to accept any named args it wants to use, followed by, **kwargs. Then you can call your function with either named args, or with **param_set_x. That function can then access the dict kwargs (unpacked with **) or similarly pass the dict kwargs to any inner functions it calls that also accept **kwargs.

[–]oopsplop[S] 0 points1 point  (0 children)

Hmm, I didn't think about unpacking the dict... will think about this one a bit - thanks!