id functions of ints, floats and strings

George Sakkis george.sakkis at gmail.com
Thu Apr 3 18:42:02 EDT 2008


zillo... at googlemail.com wrote:

> 1) Which of the above behaviours are reliable? For example, does a1 =
> a2 for ints and strings always imply that a1 is a2?

No.

> 2) From the programmer's perspective, are ids of ints, floats and
> string of any practical significance at all (since these types are
> immutable)?

No.

> 3) Does the behaviour of ids for lists and tuples of the same element
> (of type int, string and sometimes even float), imply that the tuple a
> = (1,) takes (nearly) the same storage space as a = 10000*(1,)? (What
> about a list, where elements can be changed at will?)

No.

Regards,
George



More information about the Python-list mailing list