ib_async icon indicating copy to clipboard operation
ib_async copied to clipboard

Remove mutable default arguments

Open npbaskerville opened this issue 1 year ago • 1 comments

For example reqHistoricalData has a mutable default argument. I won't list them all here, but a simple PR is required to replace any such cases with immutable default args. Since the code is typed, it will be easy to search for e.g. : List[ and find some of them.

I'm happy to contribute the PR

npbaskerville avatar Oct 18 '24 13:10 npbaskerville

Good catch.

It looks like most of cases are only parameters for sending data, so technically it's "safe" because the methods never modify the parameters, but still good to be more correct overall.

Feel free to update and add a PR. Just use the next branch for updates.

The data sending API treats empty lists and None as the same value (both just send ""), so modification should be as simple as updating defaults to list[thing] | None = None almost everywhere.

mattsta avatar Oct 18 '24 15:10 mattsta