I had in my code a bug like this (dt is a string):
if 'char' or 'CHAR' in dt:
foo = 'ch'
and it took me a while to debug it. If I am correct, the first operand always evaluates to true, which causes the body of the if statement to always execute.
In C++ I would get a warning in some of these cases, making the annihilation of such bugs easy.
Is there any way that I can get Python warn me about these situations, or not (because it gets interpreted or something)?
Aucun commentaire:
Enregistrer un commentaire