DEV Community

Discussion on: Opinions on truthiness across languages

Collapse
 
lukaszkuczynski profile image
lukaszkuczynski • Edited

For me - but it's only an opinion - the very true is that only Booleans should be true. Of course, it's short to write, and I am lazy, too. I am using Pythonic truthiness very often. But how much more straightforward it is to treat true as true, and false as false. It would be more readable to use string.is_empty() or array.no_elements().

Collapse
 
wrschneider profile image
Bill Schneider

Are you arguing for static compile-time type checking in general, or specifically that if/while etc. should not accept non-boolean types?

Collapse
 
lukaszkuczynski profile image
lukaszkuczynski

I mean that it's more clear when we explicitly say: I am returning a boolean value. I am far from static type checking.