Sharing, mutability, and immutability Ruth

Sharing, mutability, and immutability Ruth
1 / 1
Sharing, mutability, and immutability Ruth - slide 1 of 18 Sharing, mutability, and immutability Ruth - slide 2 of 18 Sharing, mutability, and immutability Ruth - slide 3 of 18 Sharing, mutability, and immutability Ruth - slide 4 of 18 Sharing, mutability, and immutability Ruth - slide 5 of 18 Sharing, mutability, and immutability Ruth - slide 6 of 18 Sharing, mutability, and immutability Ruth - slide 7 of 18 Sharing, mutability, and immutability Ruth - slide 8 of 18 Sharing, mutability, and immutability Ruth - slide 9 of 18 Sharing, mutability, and immutability Ruth - slide 10 of 18 Sharing, mutability, and immutability Ruth - slide 11 of 18 Sharing, mutability, and immutability Ruth - slide 12 of 18 Sharing, mutability, and immutability Ruth - slide 13 of 18 Sharing, mutability, and immutability Ruth - slide 14 of 18 Sharing, mutability, and immutability Ruth - slide 15 of 18 Sharing, mutability, and immutability Ruth - slide 16 of 18 Sharing, mutability, and immutability Ruth - slide 17 of 18 Sharing, mutability, and immutability Ruth - slide 18 of 18
Sharing, mutability, and immutability Ruth Anderson UW CSE 160 Autumn 2022 1 Topics for Today variables and objects Changingcreating bindings vs. changingmodifying objects Mutability vs. immutability Review of types 2 Copying and mutation

Related Topics

Download this presentation From Below

"Sharing, mutability, and immutability Ruth" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentation Transcript

01
Sharing, mutability, and immutability Ruth Anderson
UW CSE 160
Autumn 2022 1<br>
02
Topics for Today variables and objects
Changing/creating bindings vs. changing/modifying objects
Mutability vs. immutability
Review of types 2<br>
03
Copying and mutation list1 = ["e1", "e2"]
list2 = list1
list3 = list(list1) # make a copy; also “list1[:]”
print(list1, list2, list3)
list1.append("e3")
list2.append("e4")
list3.append("e5")
print(list1, list2, list3)
list1 = list3
list1.append("e6")
print(list1, list2, list3) 3 See in python tutor<br>