Closed patrickBerry closed 4 years ago
Where are they mutated?
Not sure really. I don't know the codebase well enough to say. I just know that when mutable are used as defaults it can cause bugs down the road. I ran the deepsource.io GitHub plugin on a project of mine that uses Curio (big fan btw) and found this as one of the reports. There were a number of other possible issues reported, but this issue seemed the easiest to report for a pull request.
I've looked at the code and the only use of args and kwargs is as a pass-through to a func(*args, **kwargs) call. There is no mutation. As a general rule, I don't like complicating code to account for "what-if" scenarios that never happen.
Default arguments that are mutable are bad because they are the same object and one modification can affect the next call and cause unintended behavior. If this was the intended behavior, then at least a comment should be added stating that such behavior was intended.