インデクサー

class Car:
  def __init__(self):
    self.ids = ["TOYOTA", "NISSAN", "HONDA"]
    
  def __getitem__(self, c):
    return self.ids[c]

  def __setitem__(self, c, v):
    self.ids[c] = v

c = Car()
print(c[0])
c[2] = "MITSUBISHI"
print(c[2])