• SpeakinTelnet
    arrow-up
    61
    arrow-down
    3
    ·
    4 months ago
    link
    fedilink

    My secret to high uptime:

    while True:
        try:
            main()
        except:
            pass
    
    • Phegan
      arrow-up
      4
      arrow-down
      0
      ·
      4 months ago
      link
      fedilink

      Someone is absolutely going to think this is a real recommendation and do it.

      • LKC
        arrow-up
        24
        arrow-down
        0
        ·
        4 months ago
        link
        fedilink

        Basically sweeps errors under rug.

        No error handling and go again.

      • SpeakinTelnet
        arrow-up
        13
        arrow-down
        0
        ·
        4 months ago
        link
        fedilink

        There you go:

        # Start an infinite loop because True will always be True
        while True: 
            # try to run the main function, usually where everything happens
            try:
                main()
            # in the case an exception is raised in the main function simply discard (pass) and restart the loop
            except:
                pass
        
    • LKC
      arrow-up
      1
      arrow-down
      0
      ·
      4 months ago
      link
      fedilink

      deleted by creator