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”

  • Kairos@lemmy.today
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    9 days ago

    Maybe they did “False is True” because they’re both the same Python object?

      • Kairos@lemmy.today
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        9 days ago

        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
          link
          fedilink
          arrow-up
          5
          ·
          9 days ago

          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.