A RetroSearch Logo

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

Search Query:

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

[Python-Dev] a quit that actually quits

[Python-Dev] a quit that actually quitsFredrik Lundh fredrik at pythonware.com
Wed Dec 28 11:40:33 CET 2005
Jeremy Kloth wrote:

> Ka-Ping Yee wrote:
> > I'd be happy with having Python exit when the user types just plain
> > 'exit' without parentheses, but only in that case, not others.
> > However, i'm starting to think that may be impossible to implement.
> > I can't think of any way to make 'print exit' not exit, for example.
>
> OK, here's one:
>
> def quithook(obj, _exit=__builtins__.exit, _displayhook=sys.displayhook):
>     if obj is _exit: raise SystemExit
>     _displayhook(obj)
> sys.displayhook = quithook
>
> It does, however, fall into the whole issue of chaining that Skip brought up
> earlier.

as well as various introspection-related issues:

    >>> import foo
    >>> cb = foo.getcallback()
    >>> # let's see what it is
    >>> cb

    $

(by the way, it's "__builtin__", not "__builtins__".  the former is a module,
the latter a CPython implementation detail)

</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