[issue16286] Optimize a==b and a!=b for bytes and str

Raymond Hettinger report at bugs.python.org
Tue Oct 23 03:56:04 CEST 2012


Raymond Hettinger added the comment:

Rather than see statistics, I'm curious about what circumstances where the optimization would kick in.   Interned strings are pre-hashed but they already benefit from an identity-implies-equality check.  Dicts and sets already incorporate a check-hash-before-equality check.

That raises the question of what strings ever have had their hash already computed if the string hasn't been interned or has been used in a dict or set?

P.S.  I rather like the optimization and don't want to discourage it.  I'm just curious about what the current optimizations are missing.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16286>
_______________________________________


More information about the Python-bugs-list mailing list