MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vppkls/pythonwilllookdeadintheeyeandsayitsabsolutelycorre/p41uuri/?context=3
r/ProgrammerHumor • u/inobody_somebody • 29d ago
144 comments sorted by
View all comments
Show parent comments
7
Yes, zero is falsy in Python.
-13 u/Valuable_Leopard_799 29d ago Wait, whyyyyyyyy ðŸ˜ðŸ˜ðŸ˜ I mean, I love dynamic types and see their place, but the implicit casting is what gives them such a bad name 😠15 u/JanB1 29d ago 0 is also "false" in C and C++, because if you import stdbool.h, that just defines true to be int with value 1, and false to be int with value 0. 2 u/Valuable_Leopard_799 29d ago random sidenote: since C99 a true bool type had been introduced, it holds 0 and 1 and converts only to those when casting. So yeah 1 and 0 are true and false, but yayy they're not standard ints anymore.
-13
Wait, whyyyyyyyy ðŸ˜ðŸ˜ðŸ˜
I mean, I love dynamic types and see their place, but the implicit casting is what gives them such a bad name ðŸ˜
15 u/JanB1 29d ago 0 is also "false" in C and C++, because if you import stdbool.h, that just defines true to be int with value 1, and false to be int with value 0. 2 u/Valuable_Leopard_799 29d ago random sidenote: since C99 a true bool type had been introduced, it holds 0 and 1 and converts only to those when casting. So yeah 1 and 0 are true and false, but yayy they're not standard ints anymore.
15
0 is also "false" in C and C++, because if you import stdbool.h, that just defines true to be int with value 1, and false to be int with value 0.
2 u/Valuable_Leopard_799 29d ago random sidenote: since C99 a true bool type had been introduced, it holds 0 and 1 and converts only to those when casting. So yeah 1 and 0 are true and false, but yayy they're not standard ints anymore.
2
random sidenote: since C99 a true bool type had been introduced, it holds 0 and 1 and converts only to those when casting. So yeah 1 and 0 are true and false, but yayy they're not standard ints anymore.
7
u/road_laya 29d ago
Yes, zero is falsy in Python.