I've always coded in the style of if not value, however, a few guides have brought to my attention that while this style works, it seems to have 2 potential problems:
- It's not completely readable; if value is Noneis surely more understandable.
- This can have implications later (and cause subtle bugs), since things like []and0will evaluate toFalseas well.
I am also starting to apply this idea to other comparisons, such as:
- if not valuevs- if value is False
- if not valuevs- if value is []
And so goes the list...
The question is, how far do you go with the principle? Where to draw the line, while keeping your code safe?
Should I always use the if value is None style no matter what?
 
     
     
     
     
     
     
    