How is numpy’s fancy indexing implemented?
You have three questions: 1. Which __xx__ method has numpy overridden/defined to handle fancy indexing? The indexing operator [] is overridable using __getitem__, __setitem__, and __delitem__. It can be fun to write a simple subclass that offers some introspection: >>> class VerboseList(list): … def __getitem__(self, key): … print(key) … return super().__getitem__(key) … Let’s make an … Read more