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')

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to