News for hackers. Stuff that matters.
Re:What the Fuck Python by 3eb7988a1663 on Saturday July 19, 2025 @05:49PM (#44619750)

  prefer bool() threw an exception on receiving a string, rather than act the way it does now.
That breaks the truthiness cornerstone of the language. You can write

  a = 1 # or [], (), "yo", "false", 3.2, MyFooClass(), (1,), False
  if a:
    fire_ze_missles()
  else:
    declare_peace()
Upon encountering `a`, Python is evaluating bool(a). If that no longer works for strings, you now need a separate code path for determining a non-empty string.

It can short-circuit the brain upon reading a word that you know means false, but the Python rules are consistent. "Empty" is False, everything else is True.

Re:What the Fuck Python by moffkalast on Saturday July 19, 2025 @05:52PM (#44619768)
You can write that yes, but I'm calling the police.
Re:What the Fuck Python by jonathrg on Saturday July 19, 2025 @08:00PM (#44620635)
You can't go calling the police on people for writing idiomatic Python code.