Closed dmwyatt closed 4 years ago
Just ran across this issue myself. As a workaround, you can explicitly pass in the parameter query={}
on each call.
FWIW, the same issue (mutable default argument) occurs in the previous function above where you've fixed it in your pull request. A quick search revealed a couple of others too - I've listed all the occurrences (including the on in your PR) here:
trellolist.py
:
def list_cards(..., query={})
def list_cards_iter(..., query={})
trelloclient.py
:
def __init__(..., proxies={})
def search(..., models=[], board_ids=[], org_ids=[], card_ids=[], ...)
Don't know if you fancy amending your PR to include those as well? (or cancelling it and doing a new one - I'm afraid I don't know how these things work! If not, I could have a go myself...)
In python, mutable default arguments are "remembered" between calls.
The first time you call
lst.list_cards_iter()
, the value of query will be{}
. The next time you calllst.list_cards_iter()
, the value of query will be:...because thats what it gets set to while the method is running the first time.
https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments