this post was submitted on 15 Aug 2025
24 points (96.2% liked)

Programmer Humor

25730 readers
1229 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Does anyone remember an old blog post where someone used various Python language hacks to override boolean primitives, such that the statement false == true evaluated as true? I'm 90% sure it was python, but maybe it was some other language.

I've been looking for that post recently, but haven't had any luck.

Thanks to antagonistic for finding it! I guess it was less of an "exploit", and more of a "please don't touch the loaded foot-gun"

you are viewing a single comment's thread
view the rest of the comments
[–] LodeMike@lemmy.today 4 points 1 day ago (4 children)

Maybe they did "False is True" because they're both the same Python object?

[–] solrize@lemmy.ml 5 points 1 day ago (1 children)

I just checked and they aren't.

[–] LodeMike@lemmy.today 3 points 1 day ago* (last edited 1 day ago) (1 children)

Maybe they defined them as variable names instead?

Or they could have just changed the language. Do you remember them compiling or editing C? (Python is usually run on cpython)

[–] solrize@lemmy.ml 5 points 1 day ago (1 children)

True is False gives false in Python 2.7.18 as well as 3.x. But, in 2.x, they aren't keywords, so you can say True=False=5 and then they are both the same object.

[–] LodeMike@lemmy.today 3 points 1 day ago

I really need to stop trusting how durable this language is.

load more comments (2 replies)