[Python-ideas] Copy-on-write when forking a python process
Terry Reedy
tjreedy at udel.edu
Wed Apr 13 17:56:07 CEST 2011
On 4/13/2011 10:14 AM, Antoine Pitrou wrote:
> Le mercredi 13 avril 2011 à 09:47 -0400, Jim Jewett a écrit :
>> On 4/13/11, Antoine Pitrou<solipsis at pitrou.net> wrote:
>>> On Tue, 12 Apr 2011 23:40:02 -0400
>>> Terry Reedy<tjreedy at udel.edu> wrote:
>>
>>>> "Changed in version 2.3: Interned strings are not immortal (like they
>>>> used to be in Python 2.2 and before); you must keep a reference to the
>>>> return value of intern() around to benefit from it."
>>
>>> That's a rather strange sentence, because interned strings *are*
>>> immortal (until the interpreter is shutdown).
>>
>> The purpose of that change (which may no longer be effective; I
>> haven't checked recently) was that they were no longer immortal. If
>> the last reference outside the intern dictionary was removed, then the
>> string was removed from the intern dictionary as well. Intern was a
>> way to de-duplicate, but it didn't (by itself) make anything immortal.
>
> They're de-facto immortal, since the user can't access the intern
> dictionary to remove these strings. That sentence looks like a very
> misleading way of explaining an implementation detail and making it look
> like a user-visible semantic change.
Quoted sentence was from 2.7. 3.2 has "Interned strings are not
immortal; you must keep a reference to the return value of intern()
around to benefit from it." This actually makes sense if true: if user
cannot access string, it should go away. But I have no idea.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list