How come regex match objects aren’t iterable even though they implement __getitem__?
There are lies, damned lies and then there is Python documentation. Having __getitem__ for a class implemented in C is not enough for it to be iterable. That is because there are actually 2 places in the PyTypeObject where the __getitem__ can be mapped to: tp_as_sequence and tp_as_mapping. Both have a slot for __getitem__ ([1], … Read more