O'Reilly logo
  • Shobana Shanker thinks this is interesting:

Achieving this kind of seamless syntax integration is easy in Python—we just have to implement the appropriate special methods, which in the case of the item access operator are __getitem__(), __setitem__(), and __delitem__()


Cover of Programming in Python 3: A Complete Introduction to the Python Language, Second Edition


this gives a decent explanation of these special methods https://stackoverflow.com/questions/43627405/understanding-getitem-method