[Python-Dev] Re: Alternative implementation of string interni ng

Delaney, Timothy tdelaney@avaya.com
Wed, 3 Jul 2002 17:17:54 +1000


> From: Oren Tirosh [mailto:oren-py-d@hishome.net]
> 
> > Oren Tirosh wrote:
> > > alias for this type.  No two istr instances are equal 
> unless they are
> > > identical.  I guess PyString_CheckExact would need to be 
> 
> you assuming
> that == would be equivalent to 'is' for istrs?  The == 
> operator should work 
> exactly the same, just possibly a little faster when 
> comparing two istrs.
> 
>   (type(s) is istr and type(t) is istr and s == t) implies (s is t).

Do you mean that comparing two instances of istr would use *is*, but
comparing an istr with any other instance would use the normal str compare?
Because that is not how it has come across.

My first thought when I saw this proposal was "neat". My second was "yuk".

The #1 most important consideration here is backwards compatibility IMO.
Whilst I would be personally unaffected by this change (allowing interned
strings to be collected), we've already had examples of people and code that
would be.

Tim Delaney