Python custom class에서 array처럼 접근하기!

|
class testClass():
    def __init__(self):
        self.dataList = [1,2,3,4,5]
    def __getitem__(self, key):
        return self.dataList[key]

a = testClass()
a[1]
# 2
a[2]
# 3