Hacker News new | ask | show | jobs
by nothrabannosir 396 days ago
Akshually, implicitly casting any non Boolean type to true or false is no better than implicitly casting “0” to 0. :) B-)
1 comments

No better based on what criteria? In what language? This is typical in Python and done even by core-devs. It is how the language was designed and it was designed to support that.
In the "akshually" sense. "Zen of programming" (or "I'm smart because I use the word monoid unironically").

"If is an anti pattern", "null values are an anti pattern", "`string' is an anti-type", "util libraries are an anti pattern", etc.

And of course "boolean is an anti type" but let's not get into that. :D

(Nor into the value of "idiomatic python" as an argument on healthy programming habits....)

Ah got it. Based on personal opinion. Thanks for explaining.
You’re welcome! ;)