Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 assign a value to a dict change all the values
Say you have a container with memory locations (references) in it.

A normal copy (x = y) just copies the memory location of the container.

A shallow copy (x = y[:]) makes a new container, with the memory locations that were in the old container.

A deep copy (x = deepcopy(y)) makes a new container, with new versions of anything that is just a memory location in the old container.
aster likes this post
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures


Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)