[Python-3000] Lazy strings (was Re: Py3k release schedule worries)

Larry Hastings larry at hastings.org
Fri Jan 12 23:41:49 CET 2007


Jim Jewett wrote:
> On 1/12/07, Guido van Rossum <guido at python.org> wrote:
>> But IIUC the string may already have been seen by other code, right?
>> This violates immutability, and that's not acceptable.
> No.
>
> IIRC, the string was rendered as soon as any code viewed it.  Since it 
> isn't rendered yet, nothing has viewed it previously.
"Yes," because someone (the caller) is viewing it *now*.  The caller 
might compute something based on the invalid (unrendered) string and 
think it had been successful.  If those results outlive the memory 
exception and get used for further processing, the program has just 
silently diverged from correct behavior.

Of the five I've proposed so far, Guido's right, only changing the API 
will preserve the speedup *and* result in correct behavior.  But I 
maintain some dim hope that a sixth exists, waiting only to be suggested 
by some shining intellect.

Cheers,


/larry/


More information about the Python-3000 mailing list