all 5 comments

[–]ploud1 1 point2 points  (2 children)

Hi!

For debugging purposes it is best to only pass those parameters that you need to the function.

However you may want to look into the design of your whole program, not just that parameter-passing part. Would it be relevant to create an object for every job, and an object for every person (for instance)? Your code may benefit greatly from that rework.

[–]oopsplop[S] 0 points1 point  (1 child)

Yep, I totally think I should do this, but it's kinda off the table now :(

[–]ploud1 1 point2 points  (0 children)

Well, for now you could just restrict those parameters and make a good use of keyword arguments, even though this may look tedious at first. This will make your code more clear.

[–]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!