On Fri, Sep 25, 2020 at 08:52:45PM -1000, David Mertz wrote:
On Fri, Sep 25, 2020, 5:49 PM Steven D'Aprano
Since both None and () are likely to be legitimate indexes, and NotImplemented is less likely to be such, I think this supports using NotImplemented.
I think your arguments for NotImplemented vs None or () are solid. But I'm having trouble crossing my eyes in just the way that will make those words fit the purpose.
What about instead subclassing NotImplemented as maybe NoIndex? That would make sense in reading, and have the same favorable characteristics. Moreover, being a brand new class, we can be certain no one is already using it.
I don't object to this. If we added NoIndex, we could make it unhashable too. But I wouldn't want the PEP to rely on the Steering Council accepting a new builtin just for this. If the Steering Council will accept a new builtin, then I agree, this is a nice way of handling it and avoiding even the faintest possibility of collision with code that uses NotImplemented as a key. -- Steve