[Tutor] introspection
Alex Kleider
akleider at sonic.net
Fri May 8 05:23:18 CEST 2015
On 2015-05-07 19:10, Dave Angel wrote:
>> def get_name(localmap, item):
>> """As suggested.
>> Returns 'a' name, not necessarily 'the' name."""
>> for name in localmap:
>> if localmap[name] == item:
>
> This is not likely to be what was intended. You want
> if localmap[name] is item:
> That can identify if one of the names happens to be bound to the SAME
> object being examined. Rather than one that happens to have the same
> value.
Correction noted. Thank you for that. The distinction is important.
('==' vs 'is')
More information about the Tutor
mailing list