Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

c[i] is just shorthand for c.__getitem__(i). The __getitem__ is of course fast for lists but could be arbitrarily slow and/or have side effects for custom objects. Since Python is not statically typed, there is no way of knowing the output of __getitem__ without actually calling it.