Feb. 13, 2007
8:32 p.m.
Martin v. Löwis wrote:
Greg Ewing schrieb:
The string comparison method knows when both strings are interned
No, it doesn't - see stringobject.c:string_richcompare.
Well, I'm surprised and confused. It's certainly possible to tell very easily whether a string is interned -- there's a PyString_CHECK_INTERNED macro that tests a field in the string object header. But, I can't find anywhere that it's used in the core, apart from the interning code itself and the string alloc/dealloc code. Can anyone shed any light on this? It seems to me that by not using this information, only half the benefit of interning is being achieved. -- Greg