Comment on Python Performance: Why 'if not list' is 2x Faster Than Using len()
thebestaquaman@lemmy.world 2 weeks agoThen I absolutely understand you :)
How common it is 100 % depends on the code base and what practices are preferred. In Python code bases where I have a word in decisions, all Boolean checks should be x is True
or x is False
if x
should be a Boolean. In that sense, if I read if x
or if not x
, it’s an indicator that x
doesn’t need to be a Boolean.