This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abarnert
Recipients abarnert, abarry, curioswati, gvanrossum, ncoghlan, r.david.murray, rhettinger, serhiy.storchaka, terry.reedy
Date 2015-12-28.20:38:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1451335124.13.0.589752399479.issue25864@psf.upfronthosting.co.za>
In-reply-to
Content
The attached patch does the following:

* collections.abc.Mapping.__reversed__ = None.

* collections.abc.Iterable.__subclasshook__ checks for None the same way Hashable does:

  * This tests for any falsey value, not just None. I'm not sure this is ideal, but it's consistent with Hashable, and it's unlikely to ever matter.

  * The test will only block implicit subclassing. If a class, e.g., inherits from tuple (which is explicitly registered with Sequence, which inherits from Iterable), it's Iterable, even if it sets __iter__ = None. I think this is the right behavior, and it's consistent with Hashable.

* iter and reversed add checks for None, which raise a TypeError with the appropriate message (instead of "'NoneType' is not callable").

* datamodel.rst section "Special method names" includes a paragraph on setting special methods to None.

* Tests for changes to reversed (in test_enumerate.py), iter (in test_iter.py), Iterable (in test_collections.py), and Mapping (in collections.py).
History
Date User Action Args
2015-12-28 20:38:44abarnertsetrecipients: + abarnert, gvanrossum, rhettinger, terry.reedy, ncoghlan, r.david.murray, serhiy.storchaka, abarry, curioswati
2015-12-28 20:38:44abarnertsetmessageid: <1451335124.13.0.589752399479.issue25864@psf.upfronthosting.co.za>
2015-12-28 20:38:44abarnertlinkissue25864 messages
2015-12-28 20:38:43abarnertcreate