Closed omarmhaimdat closed 11 months ago
Thank you for this feedback. Could you please elaborate?
The simplest explanation can be found here: https://docs.quantifiedcode.com/python-anti-patterns/correctness/mutable_default_value_as_argument.html
TLDR:
The first time that the function is called, Python creates a persistent object for the list or dictionary. Every subsequent time the function is called, Python uses that same persistent object that was created from the first call to the function.
I understand the issue, however it doesnt seem to apply there, as we do not mutate the data nor the query objects contents by reference. We only re-assign a new local data
variable, but that doesn't alter the original default object.
As dictionaries are passed by reference, this might lead to unexpected behavior
https://github.com/mirage-ai-com/python-mirage-api/blob/3520cc87a91ac36d06e666ebe260d3add974f6dc/mirage_api/__init__.py#L50C52-L50C52