I know that "assigning a variable" in python is actually binding / re-binding the name (variable) to the object.
The question arises: is it possible to have the correct assignment in python, for example, to make an object equal to another object?
I assume python is not necessary:
Prohibited objects cannot be assigned because they cannot be changed
Mutable objects can be assigned because they can be changed, and this can be useful since you can manipulate a copy of the dictionary separately from the original. However, in these cases, the python philosophy offers a cloning method on a mutable object, so you can bind a copy, not the original.
So, I think the answer is that in python there is no purpose, the best way to mimic it is to bind to the cloned object
I just wanted to share this question if I missed something important here.
thank
EDIT:
The answers of Lee Ryan and Sven Marnach are good, I think the common answer is a combination of both:
For custom types, use the idiom:
a. dict = dict (b. dict )
(I assume this also has problems if the assigned class has redefined attribute access methods, but not scary :))
For volatile built-in modules (lists and dictations), the cloning / copying methods they provide (e.g. snippets, updating) are used
final built-in plug-ins cannot be changed, therefore they cannot be assigned
, , .
!