[Python-3000] String comparison

Jim Jewett jimjjewett at gmail.com
Thu Jun 7 02:09:50 CEST 2007


On 6/6/07, Stephen J. Turnbull <turnbull at sk.tsukuba.ac.jp> wrote:
> Rauli Ruohonen writes:

>  > FWIW, I don't buy that normalization is expensive, as most strings are
>  > in NFC form anyway, and there are fast checks for that (see UAX#15,
>  > "Detecting Normalization Forms"). Python does not currently have
>  > a fast path for this, but if it's added, then normalizing everything
>  > to NFC should be fast.

> If O(n) is "fast".

Normalize before hashing; then it becomes O(1) for the remaining uses.
 The hash is already O(N), and most literals already end up being
interned, which requires hashing.

-jJ


More information about the Python-3000 mailing list