[Python-Dev] exit in builtins (original) (raw)
Oliver Walczak oliver.walczak at momatec.de
Thu Aug 26 14:00:40 CEST 2004
- Previous message: [Python-Dev] decorators: If you go for it, go all the way!!! :)
- Next message: [Python-Dev] exit in __builtins__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] decorators: If you go for it, go all the way!!! :)
- Next message: [Python-Dev] exit in __builtins__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]