I may get a chance to look carefully at this in a bit, but for now:
On Tue, Sep 1, 2020 at 6:38 PM Ricky Teachey
Sorry for all the replies but I'm honestly very unsure how do this correctly under Steven's proposal.
That's OK. It's going to be tricky, and keeping backward compatibility makes that necessary. And, in fact, the current sytax is pretty tricky as well. Say you want to make a class that takes multiple indices -- like a Mtraix, for instance. your __getitem__ looks like: def __getitem__(self, index): as they all do. But what might index be? It could be one of: * an object with an __index__ method -- so a single index, simple * a slice object * a tuple, where each item in the tuple could be both of the above. Or, of course, it could be invalid, and you need to raise an Exception with a meaningful message. So there's a lot of logic there and we haven't even started in the keywords :-) But that's all OK, as the number of people that need to write these methods is small, and the number of people that can use the feature is large. -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython