What about the following function? if x == 0: return False return True I am a beginner, but I think it is more clear (at least to me) what the function does. And it is only one line longer than value = (x != 0) return value