Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 1
    Hey, thanks for the solution. I noticed a bug with the get_arguments() function in the case when positional args fill the function kwarg arguments. The else statement should contain d[parameter] = specs.defaults[i - non_default_args] where non_default_args = len(specs.args) - (len(specs.defaults) if specs.defaults else 0). Commented Feb 15, 2024 at 12:33
  • Of course, both solutions would still throw an IndexError when too many arguments are passed, so that should be caught and re-raised as the more desirable TypeError instead. Commented Feb 15, 2024 at 12:34