• boonhet@sopuli.xyz
    link
    fedilink
    arrow-up
    0
    ·
    6 days ago

    That’s , uh…

    Yeah. Cooler than anything I could’ve achieved for purposefully bad is_even

    My first idea of a purposefully bad is_even is this:

    def is_even(i):
        return True if i == 0 else not is_even(abs(i)-1)
    

    But I’m sure I could come up with worse given enough time.

    • edinbruh@feddit.it
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      6 days ago

      That’s also slower than most of the stuff you could come up with, it is so slow that there is no hyperoperation fast enough to describe it. There were other approaches that were almost worse though, like “the function is a switch-case that returns false by default. As complaint tickets are opened, more cases get added to the switch-case”