Objects ภายใน Objects สามารถเข้าถึงได้ดังนี้
ตัวอย่าง
class P:
def __init__(self):
self.w = Q()
class Q:
def __init__(self):
self.list = [3, 4, 5]
def function(self):
self.list[2] = 7
y = P()
f = [y]
print f[0].w.function()
print f[0].w.list
Output
None
[3, 4, 7]