"/a" is not "/a" ?

Christian Heimes lists at cheimes.de
Fri Mar 6 16:51:36 EST 2009


Emanuele D'Arrigo wrote:
> So, it appears that in the first case a and b are names to the same
> string object, while in the second case they are to two separate
> objects. Why? What's so special about the forward slash that cause the
> two "/a" strings to create two separate objects? Is this an
> implementation-specific issue?

Python special cases certain objects like str with one element or small
ints from -10 to +256 for performance reasons. It's version and
implementation specific and may change in the future. Do NOT rely on it!
Christian




More information about the Python-list mailing list