Is 'everything' a refrence or isn't it?

David Murmann david.murmann at rwth-aachen.de
Thu Jan 5 07:06:15 EST 2006


Claudio Grondi schrieb:
> Stuart D. Gathman wrote:
>> for (_idx = 0; _idx < NLST; ++_idx) {
>>   int *i = lst[_idx];
>>   if (*i == *_i2)
>     ^-- I have trouble with this line. Is it as is should be? I suppose 
> it is not.
> 

i think he meant

  if (*i == _i2)

but i think python does

  if (i == &_i2)

because there is only one integer object holding the value 2, so
it is sufficient to compare the addresses (i'm not sure about this,
perhaps someone smarter can clarify?).

--
David.



More information about the Python-list mailing list