News for hackers. Stuff that matters.
Re:CLI Guidelines – A guide to help you write better command... by resonantjacket5 on Friday December 04, 2020 @04:56PM (#25308671)
I mean if you did that how would you access 'quit' if it is defined? It's a bit more complicated than it seems.

Though I get your general point.

Re:CLI Guidelines – A guide to help you write better command... by cle on Friday December 04, 2020 @05:27PM (#25309117)
You just access it, it's just a normal variable.

    $ python3
    Python 3.8.6 (default, Nov 18 2020, 23:56:33)
    [GCC 9.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> quit
    Use quit() or Ctrl-D (i.e. EOF) to exit
    >>> q = quit
    >>> quit = "foo"
    >>> quit
    'foo'
    >>> quit()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'str' object is not callable
    >>> q()
    $
Re:CLI Guidelines – A guide to help you write better command... by colejohnson66 on Friday December 04, 2020 @07:37PM (#25310345)
Wait... So it’s possible to make it so you can’t use `quit()`? Just overwrite it without saving it?
Re:CLI Guidelines – A guide to help you write better command... by cle on Friday December 04, 2020 @07:58PM (#25310513)
Yes. You can still send an EOF to quit (ctrl+d), or do "raise SystemExit()" which is all quit() does anyway:

    >>> print(inspect.getsource(quit.__call__))
        def __call__(self, code=None):
            try:
                sys.stdin.close()
            except:
                pass
            raise SystemExit(code)