Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. exit

exit

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
24 Posts 18 Posters 2 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ptz@dubvee.orgP [email protected]
    This post did not contain any content.
    R This user is from outside of this forum
    R This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #5

    That just gave me the idea that it would be fun to inspect exit a little.

    Which led me down this path:

    >>> repr(exit)
    'Use exit() or Ctrl-Z plus Return to exit'
    >>> dir(exit)
    [(...), 'eof', 'name']
    >>> exit.eof, exit.name
    ('Ctrl-Z plus Return', 'exit')
    

    Okay, cool, the "Use exit() etc." blurb appears because it's the function's repr, and the string is assembled from its name and eof properties.

    Now let's try to make our own:

    >>> exit.__class__
    <class '_sitebuiltins.Quitter'>
    >>> gtfo = exit.__class__()
    TypeError: Quitter.__init__() missing 2 required positional arguments: 'name' and 'eof'
    

    Oh Python, you shouldn't have.

    >>> gtfo = exit.__class__("a big puff of smoke", "a sneaky skedaddle")
    >>> gtfo
    Use a big puff of smoke() or a sneaky skedaddle to exit
    

    Beauty!

    M L S 3 Replies Last reply
    41
    • D [email protected]

      FINALLY! This has always annoyed me. If you’re gonna go through all the trouble of identifying that I want to exit, just DO it.

      W This user is from outside of this forum
      W This user is from outside of this forum
      [email protected]
      wrote on last edited by [email protected]
      #6

      It’s not really much extra effort though

      They just added so e text to the __repr__ method on the exit callable object

      That’s much easier than figuring out if your running this interactively and trying to figure out if this is going to break stuff.

      S 1 Reply Last reply
      5
      • W [email protected]

        It’s not really much extra effort though

        They just added so e text to the __repr__ method on the exit callable object

        That’s much easier than figuring out if your running this interactively and trying to figure out if this is going to break stuff.

        S This user is from outside of this forum
        S This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #7

        Lemme golf that

        ~ $ python
        Python 3.12.10 (main, Apr  9 2025, 18:13:11) [Clang 18.0.3 (https://android.googlesource.com/toolchain/llvm-project d8003a456 on linux
        Type "help", "copyright", "credits" or "license" for more information.
        >>> class x:
        ...  def __repr__(s):
        ...   exit(0)
        ...
        >>> xit = x()
        >>> xit
        ~ $
        

        Not that hard

        B 1 Reply Last reply
        0
        • B [email protected]

          I have a vivid memory when I was in first grade and asked my teacher if I can use the bathroom, and I got his bullshit response. I was a first grader, so I sat my ass back down and held it. Fuck this horse shit mentality.

          Fine, if you're an adult, it's juvenile, but at that point people should understand the difference. Doesn't mean I won't lambast a MFer for being a pedantic prick though.

          S This user is from outside of this forum
          S This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #8

          What other lessons did you refuse to learn in school?

          B 1 Reply Last reply
          2
          • S [email protected]

            What other lessons did you refuse to learn in school?

            B This user is from outside of this forum
            B This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #9

            Too many to count, but I learned this lesson. I just struggled with nuance in gramer as a fucking 1st grader.

            1 Reply Last reply
            2
            • ptz@dubvee.orgP [email protected]
              This post did not contain any content.
              F This user is from outside of this forum
              F This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #10

              May I exit

              1 Reply Last reply
              1
              • ptz@dubvee.orgP [email protected]
                This post did not contain any content.
                deconceptualist@lemm.eeD This user is from outside of this forum
                deconceptualist@lemm.eeD This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #11

                The dev thought "I know exactly what you meant, but I still insist you to do it my way".

                1 Reply Last reply
                15
                • B [email protected]

                  I have a vivid memory when I was in first grade and asked my teacher if I can use the bathroom, and I got his bullshit response. I was a first grader, so I sat my ass back down and held it. Fuck this horse shit mentality.

                  Fine, if you're an adult, it's juvenile, but at that point people should understand the difference. Doesn't mean I won't lambast a MFer for being a pedantic prick though.

                  P This user is from outside of this forum
                  P This user is from outside of this forum
                  [email protected]
                  wrote on last edited by [email protected]
                  #12

                  As an adult I'm asking nobody if I "may" use the bathroom. I might ask, "can I use YOUR bathroom" (notably not "may") or say "can you point me to the bathroom" because I am a human being with a right to access these facilities (Americans need not apply).

                  Teachers who feel the need to get one over on a child are pieces of shit. It teaches nobody anything except "adults are awful". Be nice to kids, you can fuck them up with something you don't think twice about.

                  1 Reply Last reply
                  6
                  • S [email protected]

                    Lemme golf that

                    ~ $ python
                    Python 3.12.10 (main, Apr  9 2025, 18:13:11) [Clang 18.0.3 (https://android.googlesource.com/toolchain/llvm-project d8003a456 on linux
                    Type "help", "copyright", "credits" or "license" for more information.
                    >>> class x:
                    ...  def __repr__(s):
                    ...   exit(0)
                    ...
                    >>> xit = x()
                    >>> xit
                    ~ $
                    

                    Not that hard

                    B This user is from outside of this forum
                    B This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #13

                    repr is generally assumed to be side effect free and cheap to run, so things like debuggers tend to show repr of things in scope, including possibly exit

                    also then it behaves differently between repl and script, since repr never gets run. to do it properly it has to be a new repl keyword I imagine, but I still don't know if I'm sold on the idea

                    S 1 Reply Last reply
                    2
                    • B [email protected]

                      repr is generally assumed to be side effect free and cheap to run, so things like debuggers tend to show repr of things in scope, including possibly exit

                      also then it behaves differently between repl and script, since repr never gets run. to do it properly it has to be a new repl keyword I imagine, but I still don't know if I'm sold on the idea

                      S This user is from outside of this forum
                      S This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #14

                      Good points. You're right, it does need solved at the shell level. Glad they did so.

                      1 Reply Last reply
                      1
                      • R [email protected]

                        That just gave me the idea that it would be fun to inspect exit a little.

                        Which led me down this path:

                        >>> repr(exit)
                        'Use exit() or Ctrl-Z plus Return to exit'
                        >>> dir(exit)
                        [(...), 'eof', 'name']
                        >>> exit.eof, exit.name
                        ('Ctrl-Z plus Return', 'exit')
                        

                        Okay, cool, the "Use exit() etc." blurb appears because it's the function's repr, and the string is assembled from its name and eof properties.

                        Now let's try to make our own:

                        >>> exit.__class__
                        <class '_sitebuiltins.Quitter'>
                        >>> gtfo = exit.__class__()
                        TypeError: Quitter.__init__() missing 2 required positional arguments: 'name' and 'eof'
                        

                        Oh Python, you shouldn't have.

                        >>> gtfo = exit.__class__("a big puff of smoke", "a sneaky skedaddle")
                        >>> gtfo
                        Use a big puff of smoke() or a sneaky skedaddle to exit
                        

                        Beauty!

                        M This user is from outside of this forum
                        M This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #15

                        It never occurred me to inspect this, nice find.

                        1 Reply Last reply
                        2
                        • ptz@dubvee.orgP [email protected]
                          This post did not contain any content.
                          somethingburger@jlai.luS This user is from outside of this forum
                          somethingburger@jlai.luS This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #16

                          Same energy as "Option -h not recognized; use --help for the list of options".

                          ptz@dubvee.orgP D 2 Replies Last reply
                          9
                          • somethingburger@jlai.luS [email protected]

                            Same energy as "Option -h not recognized; use --help for the list of options".

                            ptz@dubvee.orgP This user is from outside of this forum
                            ptz@dubvee.orgP This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #17

                            I can actually forgive that one since it's the fallback for any invalid argument.

                            rikudou@lemmings.worldR 1 Reply Last reply
                            11
                            • ptz@dubvee.orgP [email protected]

                              I can actually forgive that one since it's the fallback for any invalid argument.

                              rikudou@lemmings.worldR This user is from outside of this forum
                              rikudou@lemmings.worldR This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #18

                              Not always, way too often you just get a variation of "invalid option, use --help to get a list of options"

                              How about you show me by default like most apps?

                              S 1 Reply Last reply
                              1
                              • R [email protected]

                                That just gave me the idea that it would be fun to inspect exit a little.

                                Which led me down this path:

                                >>> repr(exit)
                                'Use exit() or Ctrl-Z plus Return to exit'
                                >>> dir(exit)
                                [(...), 'eof', 'name']
                                >>> exit.eof, exit.name
                                ('Ctrl-Z plus Return', 'exit')
                                

                                Okay, cool, the "Use exit() etc." blurb appears because it's the function's repr, and the string is assembled from its name and eof properties.

                                Now let's try to make our own:

                                >>> exit.__class__
                                <class '_sitebuiltins.Quitter'>
                                >>> gtfo = exit.__class__()
                                TypeError: Quitter.__init__() missing 2 required positional arguments: 'name' and 'eof'
                                

                                Oh Python, you shouldn't have.

                                >>> gtfo = exit.__class__("a big puff of smoke", "a sneaky skedaddle")
                                >>> gtfo
                                Use a big puff of smoke() or a sneaky skedaddle to exit
                                

                                Beauty!

                                L This user is from outside of this forum
                                L This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #19

                                Obviously they need to make exit's repr method raise a SystemExit

                                1 Reply Last reply
                                1
                                • rikudou@lemmings.worldR [email protected]

                                  Not always, way too often you just get a variation of "invalid option, use --help to get a list of options"

                                  How about you show me by default like most apps?

                                  S This user is from outside of this forum
                                  S This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #20

                                  They meant that you'd get the same message no matter what unrecognized option you use. So it's not like they added a specific check that if you type in -h they will give you the message, but instead you get the same message for any unrecognized option.

                                  The thing in the OP only occurs if you type exit, so they specifically added that message to be shown when the interpreter clearly knows what you want, but you just didn't say it exactly right.

                                  rikudou@lemmings.worldR 1 Reply Last reply
                                  1
                                  • R [email protected]

                                    That just gave me the idea that it would be fun to inspect exit a little.

                                    Which led me down this path:

                                    >>> repr(exit)
                                    'Use exit() or Ctrl-Z plus Return to exit'
                                    >>> dir(exit)
                                    [(...), 'eof', 'name']
                                    >>> exit.eof, exit.name
                                    ('Ctrl-Z plus Return', 'exit')
                                    

                                    Okay, cool, the "Use exit() etc." blurb appears because it's the function's repr, and the string is assembled from its name and eof properties.

                                    Now let's try to make our own:

                                    >>> exit.__class__
                                    <class '_sitebuiltins.Quitter'>
                                    >>> gtfo = exit.__class__()
                                    TypeError: Quitter.__init__() missing 2 required positional arguments: 'name' and 'eof'
                                    

                                    Oh Python, you shouldn't have.

                                    >>> gtfo = exit.__class__("a big puff of smoke", "a sneaky skedaddle")
                                    >>> gtfo
                                    Use a big puff of smoke() or a sneaky skedaddle to exit
                                    

                                    Beauty!

                                    S This user is from outside of this forum
                                    S This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by
                                    #21

                                    Does gtfo() then work as expected?

                                    1 Reply Last reply
                                    0
                                    • S [email protected]

                                      They meant that you'd get the same message no matter what unrecognized option you use. So it's not like they added a specific check that if you type in -h they will give you the message, but instead you get the same message for any unrecognized option.

                                      The thing in the OP only occurs if you type exit, so they specifically added that message to be shown when the interpreter clearly knows what you want, but you just didn't say it exactly right.

                                      rikudou@lemmings.worldR This user is from outside of this forum
                                      rikudou@lemmings.worldR This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by
                                      #22

                                      I mean, if I didn't use a correct flag, my next command will probably include -h / --help

                                      S 1 Reply Last reply
                                      0
                                      • rikudou@lemmings.worldR [email protected]

                                        I mean, if I didn't use a correct flag, my next command will probably include -h / --help

                                        S This user is from outside of this forum
                                        S This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #23

                                        You aren't wrong, it wouldn't be bad for it to just print the help in that case, at least when running interactive.

                                        For automation, printing the full help of a more complex command would completely trash logs.

                                        1 Reply Last reply
                                        0
                                        • somethingburger@jlai.luS [email protected]

                                          Same energy as "Option -h not recognized; use --help for the list of options".

                                          D This user is from outside of this forum
                                          D This user is from outside of this forum
                                          [email protected]
                                          wrote on last edited by
                                          #24

                                          Or more subtly, when the command uses BSD (nowadays Go) style single-dash args, so it wants -help and not --help.

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups