I want to check the presence of a key in the dictionary as "if the key is not in the dictionary: do something", I have already done this several times, but this time it behaves strangely.
in particular:
termCircuit = termCircuitMap[term]
returns KeyError
when I debugged this code in Eclipse PyDev, I got the following (using expressions):
term in termCircutiMap
Does anyone understand how this is possible? I thought that if something is "in" the key set, then it is "in" the dictionary.
I am enclosing a rating screenshot.

Thanks so much for the explanation :)
jlanik
source share