I have this code in a decorator:
is_local_valid = ['system_id', 'server_id', 'sensor_id']
local_params = [x for x in is_local_valid if x in kwargs.keys() and kwargs[x].lower() is 'local'] + [y for y in args if y.lower() is 'local']
if local_params == []:
raise AssertionError("Tried to access the database from a non connected profile")
I noticed that the is
infix operator for comparing two strings returns False in this case, even when kwargs[x].lower()
equals to local
. The ==
operator does return True, though. Both are str
, of course.
Any clue on what's going on?