String Identity Test
Terry Reedy
tjreedy at udel.edu
Wed Mar 4 03:02:52 EST 2009
Avetis KAZARIAN wrote:
> After reading the discussion about the same subject ( From: "Thomas
> Moore" <jsfrank.c... at msa.hinet.net> Date: Tue, 1 Nov 2005 21:45:56
> +0800 ), I tried myself some tests with some confusing results (I'm a
> beginner with Python, I'm coming from PHP)
For immutable objects, identity is essentially irrelevant. Whether an
implementation conserves space by reusing immutable objects with a given
value, and if so, how so, depends on the particular version of a
particular implementation. Unless one in interested in interpreter
implementation, I advise against paying too much attention to the issue.
It seems to generate more confusion than enlightenment.
> How does Python manage strings as objects?
Python the language does not 'manage' objects. Particular interpreters
do what they do. The CPython sources are decently readable.
tjr
More information about the Python-list
mailing list