Mark Dickinson added the comment:

> On other hand, this optimization already is implemented for integers, 
> strings, bytes and slices.

Probably for good reasons, though, that don't necessarily apply to general 
containers / other objects.

I can see the possible value for strings and bytes, where filtering on a 
particular value might involve a good number of `s == s` comparisons 
(especially given string interning). Similarly, I could believe that small 
integer caching means that `0 == 0` or `1 == 1` comparisons happen often enough 
to make the 'is' optimisation worth it. I'm a bit bemused by the slice case, 
though.

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30907>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to