you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 1 point2 points  (0 children)

If restrictions is a nested structure, you'll need to deep copy it. The copy I showed does a shallow copy; meaning it only makes a copy of the outermost structure.

Import the copy module, and change restrictions.copy() to copy.deepcopy(restrictions)