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/2004-August/048380.html below:

[Python-Dev] exit in __builtins__

[Python-Dev] exit in __builtins__ [Python-Dev] exit in __builtins__Oliver Walczak oliver.walczak at momatec.de
Thu Aug 26 14:00:40 CEST 2004
Dear list,

as I am already quite experienced in python programming I recently started
to dive into the C-depths of the language. So it was a logical implication
to register for this newsgroup as there is no one else I can talk about
this.

So here's one thing I tried to evolve out of the sources but couldn't find
out how it works internally:

If you call dir(__builtins__) after starting a python (2.3.4) session you
get a list all well known builtin functions. I noticed, that there is
already an exit function available as builtin (NOT sys.exit!!). But when you
call exit(0) it says

TypeError: 'str' object is not callable

So I called

print __builtins__.exit.__doc__

And surprisingly I got the doc string from str. So I started browsing the
sources, and in ./Python/bltinmodule.c there get most of the builtin
functions attached to __builtin__, but not the "exit" call.

Is it a bug or a feature? exit as builtin is not documented anywhere and I
cannot find out where it gets included or attached to the str object in the
sources. Any idea?

Best regards
Oliver

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