Understanding python functions - Instant Python tutorial

Wayne Brehaut wbrehaut at mcsnet.ca
Fri Jul 13 20:08:52 CEST 2007


On Fri, 13 Jul 2007 18:49:06 +0200, Wildemar Wildenburger
<wildemar at freakmail.de> wrote:

>Wildemar Wildenburger wrote:
>> x = [1, 2, 3]
>> y = [1, 2, 3]
>> id(x), id(y)
>> x == y
>> x is y
>>   
>Ooops!
>
>Make that:
>
>x = [1, 2, 3]
>y = [1, 2, 3]
>id(x); id(y)
>x == y
>x is y
>
>(had to be a semicolon there)

Not "had to be" since a discerning reader will note that the two
values in the list:

	>>> id(x), id(y)
	(19105872, 19091664)

are different, and can guess that id() means "address of".  But "nicer
to be" perhaps since it makes it even more clea rto discerning
readers, and more likely clear to others.  ;-)

	>>> id(x); id(y)
	19105872
	19091664

wwwayne



More information about the Python-list mailing list