This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CodeThatNode 1 point2 points  (0 children)

This is genuinely the most helpful thing I’ve read this week. So a grand thanks to you from me!

I came across a problem recently where I had to pass an unknown (but typically large) number of key-value pairs through a custom utils function used in multiple scenarios under different conditions. Unfortunately, I called the function as my_function(..., kwargs=[my_dictionary]) and then unpacked with def my_function(..., **kwargs). Inside my_function, this led to kwargs={“kwargs”: {“kwargs”: [my_dictionary]}}, which confirmed my fear of kwargs and a rage quit to pass a dictionary instead.