CSE 163
Objects
Arpan Kapoor�Summer 2026��💭Icebreaker (discuss with neighbors):
Favorite outdoor area in Seattle or Washington?
Add to our Slido!
#2348882
Announcements
#2348882
Lesson Recap
State:
self.name
�
Behavior:
.thwip()
�
#2348882
Objects
State:
self.name
�
Behavior:
.thwip()
�
spider_man = SpiderMan(‘Peter Parker’)
amazing_sm = SpiderMan(‘Peter Parker’)
#2348882
Objects
spider_man = SpiderMan(‘Peter Parker’)
amazing_sm = SpiderMan(‘Peter Parker’)
Behavior:
.thwip()
spider_man
State:
‘Peter Parker’
Behavior:
.thwip()
amazing_sm
State:
‘Peter Parker’
#2348882
Objects
spider_man = SpiderMan(‘Peter Parker’)
amazing_sm = SpiderMan(‘Peter Parker’)
spider_man.thwip()
Behavior:
.thwip()
spider_man
State:
‘Peter Parker’
Behavior:
.thwip()
amazing_sm
State:
‘Peter Parker’
#2348882
References
spider_man = SpiderMan(‘Peter Parker’)
amazing_sm = spider_man
spider_man.thwip()
Behavior:
.thwip()
spider_man
State:
‘Peter Parker’
Behavior:
.thwip()
amazing_sm
State:
‘Peter Parker’
#2348882
State:
‘Peter Parker’
Behavior:
.thwip()
spider_man = SpiderMan(‘Peter Parker’)
amazing_sm = spider_man
spider_man.thwip()
spider_man
amazing_sm
= SpiderMan(‘Peter Parker’)
#2348882
Multiple References!
#2348882
Class
class SpiderFolk:
def __init__(self, name: str) -> None:
self.name: str = name
def thwip(self) -> None:
print(self.name + ‘: Thwip!')
A class definition
An initializer that sets fields (state)
A method (behavior)
#2348882
s1 = SpiderFolk(‘Cindy’)
s2 = SpiderFolk(‘Jessica’)
s3 = s1
s1.thwip()
s2.thwip()
s3.thwip()
s1
name:
‘Cindy'
s2
name:
‘Jessica'
s3
#2348882
What is self?
Who is self referring to for each call to thwip()?
class SpiderFolk:
def __init__(self, name):
self.name = name
def thwip(self):
print(self.name + ‘: Thwip!')
s1 = SpiderFolk(‘Cindy')
s2 = SpiderFolk(‘Jessica')
s3 = s1
s1.thwip()
s2.thwip()
s3.thwip()
#2348882