▲ 684 ▼ The Perfect Solution (programming.dev) submitted 2 years ago by JPDev@programming.dev to c/programmer_humor@programming.dev 77 comments fedilink hide all child comments
[–] Ephera@lemmy.ml 24 points 2 years ago (4 children) True or false or null. Mathematicians didn't know it yet, but numbers can now be even, odd or neither. permalink fedilink source parent hideshow 4 child comments replies: [–] dan@upvote.au 18 points 2 years ago (1 child) True or false or null. Ah, yes, a three-state boolean. permalink fedilink source parent hideshow 1 child comment replies: [–] lars@lemmy.sdf.org 1 point 2 years ago Even Linus Torvalds prefers an int-based truthiness to bool permalink fedilink source parent [–] Natanael@slrpnk.net 1 point 2 years ago (1 child) Non integers certainly aren't even or odd, so yes? permalink fedilink source parent hideshow 1 child comment replies: [–] Ephera@lemmy.ml 2 points 2 years ago Yeah, I'm chalking that up to Python's untypedness. I was going to write "integers", but technically that function takes a "num", whatever that is. For all we know, it could be a string, asking ChatGPT to hack the government. Is that even? Probably no. Or None. Or T-Rex. Without reading the entire function, we don't know that it's not returning T-Rex. Thankfully, it doesn't matter. Just stick the result into an if-else, then False and None will land you in the else-branch. And both True and our Truthiness-Rex will land you in the if-branch. Just as Guido intended. ...this rant brought to you by trauma. permalink fedilink source parent
[–] dan@upvote.au 18 points 2 years ago (1 child) True or false or null. Ah, yes, a three-state boolean. permalink fedilink source parent hideshow 1 child comment replies: [–] lars@lemmy.sdf.org 1 point 2 years ago Even Linus Torvalds prefers an int-based truthiness to bool permalink fedilink source parent
[–] lars@lemmy.sdf.org 1 point 2 years ago Even Linus Torvalds prefers an int-based truthiness to bool permalink fedilink source parent
[–] Natanael@slrpnk.net 1 point 2 years ago (1 child) Non integers certainly aren't even or odd, so yes? permalink fedilink source parent hideshow 1 child comment replies: [–] Ephera@lemmy.ml 2 points 2 years ago Yeah, I'm chalking that up to Python's untypedness. I was going to write "integers", but technically that function takes a "num", whatever that is. For all we know, it could be a string, asking ChatGPT to hack the government. Is that even? Probably no. Or None. Or T-Rex. Without reading the entire function, we don't know that it's not returning T-Rex. Thankfully, it doesn't matter. Just stick the result into an if-else, then False and None will land you in the else-branch. And both True and our Truthiness-Rex will land you in the if-branch. Just as Guido intended. ...this rant brought to you by trauma. permalink fedilink source parent
[–] Ephera@lemmy.ml 2 points 2 years ago Yeah, I'm chalking that up to Python's untypedness. I was going to write "integers", but technically that function takes a "num", whatever that is. For all we know, it could be a string, asking ChatGPT to hack the government. Is that even? Probably no. Or None. Or T-Rex. Without reading the entire function, we don't know that it's not returning T-Rex. Thankfully, it doesn't matter. Just stick the result into an if-else, then False and None will land you in the else-branch. And both True and our Truthiness-Rex will land you in the if-branch. Just as Guido intended. ...this rant brought to you by trauma. permalink fedilink source parent