Does somebody have an idea to explain that :
There is an embarrassing difference beetween Python and microPython :
Code: Select all
MicroPython v1.12-120-g4ab8bee82 on 2020-02-02; ESP32 module with ESP32
>>> False == 0
False
>>> True == 1
False
Code: Select all
Python 3.7.2 (/usr/local/bin/python3.7)
>>> False == 0
True
>>> True == 1
True
In the same way :
Code: Select all
MicroPython v1.12-120-g4ab8bee82 on 2020-02-02; ESP32 module with ESP32
>>> a = False
>>> if a :
print ("Not nul or True")
else :
print("Nul or False")
Nul or False
>>> a = 0
>>> if a :
print ("Not nul or True")
else :
print("Nul or False")
Nul or False
>>> a == False
False
but an int is not a boolean therefore 0 is not equal at False ...