[Python-ideas] Copy-on-write when forking a python process
Antoine Pitrou
solipsis at pitrou.net
Wed Apr 13 16:14:57 CEST 2011
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.
Regards
Antoine.
More information about the Python-ideas
mailing list