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"

all 16 comments

sorted by: hot top controversial new old
[–] 19 points 1 year ago (1 child)
  • [–] 12 points 1 year ago* (7 children)

    The builtin names are True and False and they became keywords a while back. true and false are just ordinary variables that you can set to whatever you want.

    Meanwhile, in Forth:

    : 2 3 ; \ define 2 as 3
    2 2 + .  6 ok   \ shows that 2+2 is now 6
    
  • source
  • hideshow 7 child comments
  • [–] 3 points 1 year ago (6 children)

    God I hated that about Python. Why tf we capitalizing True and False?

  • source
  • parent
  • hideshow 6 child comments
  • [–] 4 points 1 year ago (4 children)

    all builtin constants are capitalised.

  • source
  • parent
  • hideshow 4 child comments
  • I feel like you hear fuckery like that more in JavaScript.

  • source
  • [–] 4 points 1 year ago (4 children)

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

  • source
  • hideshow 4 child comments
  • [–] 5 points 1 year ago (3 children)

    I just checked and they aren't.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 1 year ago* (2 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)

  • source
  • parent
  • hideshow 2 child comments