Author inada.naoki
Recipients inada.naoki, remi.lapeyre, rhettinger, selik, serhiy.storchaka, tim.peters
Date 2018-06-10.06:14:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528611255.18.0.592728768989.issue33462@psf.upfronthosting.co.za>
In-reply-to
Content
I confirmed the cost is negligible.

python_startup_no_site
======================

Mean +- std dev: [master] 7.31 ms +- 0.39 ms -> [reverse] 7.41 ms +- 0.44 ms: 1.01x slower (+1%)
Mean +- std dev: [master] 7.31 ms +- 0.39 ms -> [register] 7.20 ms +- 0.28 ms: 1.01x faster (-1%)
Benchmark hidden because not significant (1): python_startup

"register" is "reverse" + following patch:

diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py
index dbe30dff1f..28a7e2586c 100644
--- a/Lib/_collections_abc.py
+++ b/Lib/_collections_abc.py
@@ -280,6 +280,9 @@ Iterator.register(bytearray_iterator)
 Iterator.register(dict_keyiterator)
 Iterator.register(dict_valueiterator)
 Iterator.register(dict_itemiterator)
+Iterator.register(type(iter(reversed({}.keys()))))
+Iterator.register(type(iter(reversed({}.values()))))
+Iterator.register(type(iter(reversed({}.items()))))
 Iterator.register(list_iterator)
 Iterator.register(list_reverseiterator)
 Iterator.register(range_iterator)
@@ -306,6 +309,12 @@ class Reversible(Iterable):
         return NotImplemented


+Reversible.register(dict)
+Reversible.register(type({}.keys()))
+Reversible.register(type({}.values()))
+Reversible.register(type({}.items()))
+
+
 class Generator(Iterator):

     __slots__ = ()
History
Date User Action Args
2018-06-10 06:14:15inada.naokisetrecipients: + inada.naoki, tim.peters, rhettinger, serhiy.storchaka, selik, remi.lapeyre
2018-06-10 06:14:15inada.naokisetmessageid: <1528611255.18.0.592728768989.issue33462@psf.upfronthosting.co.za>
2018-06-10 06:14:15inada.naokilinkissue33462 messages
2018-06-10 06:14:14inada.naokicreate