[Python-Dev] Why not using the hash when comparing strings? (original) (raw)
Hrvoje Niksic hrvoje.niksic at avl.com
Fri Oct 19 11:22:09 CEST 2012
- Previous message: [Python-Dev] Why not using the hash when comparing strings?
- Next message: [Python-Dev] Why not using the hash when comparing strings?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10/19/2012 03:22 AM, Benjamin Peterson wrote:
It would be interesting to see how common it is for strings which have their hash computed to be compared.
Since all identifier-like strings mentioned in Python are interned, and therefore have had their hash computed, I would imagine comparing them to be fairly common. After all, strings are often used as makeshift enums in Python.
On the flip side, those strings are typically small, so a measurable overall speed improvement brought by such a change seems unlikely.
- Previous message: [Python-Dev] Why not using the hash when comparing strings?
- Next message: [Python-Dev] Why not using the hash when comparing strings?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]