Author abarnert
Recipients abarnert, gvanrossum, martin.panter, ncoghlan, rhettinger, serhiy.storchaka
Date 2016-02-01.22:32:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454365979.71.0.453693844346.issue25958@psf.upfronthosting.co.za>
In-reply-to
Content
> I did actually mean a version changed notice for the data model change. I see this as a small expansion of the Python object API. Previously, __reversed__() had to be a function, now you are also allowed to set it to None. The collections ABCs are just catching up with the API change.

Are you suggesting that in Python 3.5, it's not defined what happens if you set __reversed__ = None on a sequence-like object and then call reversed()? I think any implementation has to raise a TypeError; the only difference is that we're now documenting the behavior directly, rather than forcing you to infer it from reading a half-dozen different parts of the docs and tracing through the implied behavior. It's already the best way to do it in 3.5, or even 2.5; the problem is that it isn't _obviously_ the best way. And I think a version-changed would send the wrong message: someone might think, "Oh, I can't use None here because I can't require 3.6, so what should I do? Write a method that raises TypeError when called?" (Which will work, but will then make it very hard to write a Reversible implicit ABC if they later want to.)

> Imagine someone using an Orderable virtual base class that tested for __gt__() etc.

That's part of what we're trying to solve. Do you test that with hasattr, like Sized, or do you test for getattr with default None, like Hashable?
History
Date User Action Args
2016-02-01 22:32:59abarnertsetrecipients: + abarnert, gvanrossum, rhettinger, ncoghlan, martin.panter, serhiy.storchaka
2016-02-01 22:32:59abarnertsetmessageid: <1454365979.71.0.453693844346.issue25958@psf.upfronthosting.co.za>
2016-02-01 22:32:59abarnertlinkissue25958 messages
2016-02-01 22:32:59abarnertcreate