| 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.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.