Skip to content

Duplicate query compound keys #1482

Closed Locked Answered by baphael
baphael asked this question in Q&A
Discussion options

You must be logged in to vote

Nevermind, it's caused by a lack of vigilence about Python's "Pass by object reference" mechanism. 🤦‍♂️

I've used

some_variable_name = self.rule.get("compound_query_key", [])

instead of

some_variable_name = list(self.rule.get("compound_query_key", []))
or
some_variable_name = self.rule.get("compound_query_key", []).copy()
or
some_variable_name = copy.deepcopy(self.rule.get("compound_query_key", []))

in order to work on a copy of rule's compound_query_key...

https://stackoverflow.com/questions/2465921/how-to-copy-a-dictionary-and-only-edit-the-copy

Have a nice day.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by baphael
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant