A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-December/059162.html below:

[Python-Dev] a quit that actually quits

[Python-Dev] a quit that actually quits [Python-Dev] a quit that actually quitsFredrik Lundh fredrik at pythonware.com
Wed Dec 28 08:56:14 CET 2005
Ka-Ping Yee wrote:

> Fredrik's NameError-based proposal (exit when there's an exception
> with no tb_next that says "name 'exit' is not defined") causes the
> interpreter to quit when you enter any expression involving 'exit'.
>
>     print exit                  # seems surprising
>     [3, 4, 5, exit]             # seems surprising
>     'a' in 'xyz' or exit        # desirable or undesirable?
>     del exit                    # actually happened to me
>     x = exit                    # seems surprising

the easiest way to solve this that I can think of right now is to add a
new sys variable that contains a copy of the most recent line read by
the interactive prompt.

    if sys.commandline.strip() in ("exit", "quit"):
        sys.exit()

</F>



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4