[Python-Dev] Interning string subtype instances (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 13 02:03:12 CET 2007
- Previous message: [Python-Dev] Interning string subtype instances
- Next message: [Python-Dev] Interning string subtype instances
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Josiah Carlson wrote:
def intern(st): ...
If I remember the implementation of intern correctly, that's more or less what happens under the covers.
That doesn't quite give you everything that real interning does, though. The string comparison method knows when both strings are interned, so it can compare them quickly whether they are equal or not. Your version could detect equal strings quickly, but not unequal strings.
-- Greg
- Previous message: [Python-Dev] Interning string subtype instances
- Next message: [Python-Dev] Interning string subtype instances
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]