1👍
✅
Contrary to your assertion, this is not at all specific to DRF, but a very general Python principle.
Passing any argument to a function always passes the object itself. If you then mutate that object in the function, all other references to that object will see that modification, because they remain references to the same object.
0👍
By default, in Python, all args are passed by reference (or a kind of), which mean, you are passing a reference to the object, not a copy, so if you alter the object inside a function, you are affecting the object itself, not a copy of it. You can see more details at http://robertheaton.com/2014/02/09/pythons-pass-by-object-reference-as-explained-by-philip-k-dick/
- Makemigrations not detecting changes after moving models to a modelsdirectory
- Why date range return empty query?
- Generic relation in django, queryset with aggregate
- View with form and context dict
Source:stackexchange.com