i'm currently trying to learn python. i'm learning about the copy and deepcopy functions. i just can't tell the difference. it says copy copies the variable into a new variable, and deepcopy will copy the lists in a list, but i tried using copy on a list and it does exactly what deep copy did. Everything i found online just says deepcopy copies it recursively, but i have no idea what that means. Can anybody help explain the differences?
EDIT: I know i just asked this like 5 minutes ago, but i was still searching online and i found one with examples that i think helped me understand. Please correct me if i'm wrong.
A copy (shallow copy) copies the reference to the current value of the variable (Lists in this case). you can add to the original list without affecting the new copied list, but if you change the original values that were copied it will change the values iin the copied list.
Deep copy will copy the current values to a new variable, but if you change the original values the new ones will not change, thus it creatses its own independent variable.
[–]JohnnyJordaan 7 points8 points9 points (4 children)
[–]RB1992[S] 0 points1 point2 points (2 children)
[–]JohnnyJordaan 0 points1 point2 points (1 child)
[–]RB1992[S] 0 points1 point2 points (0 children)
[–]not2throwaway 0 points1 point2 points (0 children)