Where's the source code for __builtin__?

D

Dustan

I've been paging through the source code for various C modules in
python, and wanted to find the source of some of the builtin
functions. I searched through the Modules, Objects, Python, and Parser
folder, searched docs.python.org, searched the archived messages of
this group, searched the web, and got absolutely nowhere in finding a
__builtin__.c, or anything that contains the builtin source code.

Help?
 
J

John Machin

I've been paging through the source code for various C modules in
python, and wanted to find the source of some of the builtin
functions. I searched through the Modules, Objects, Python, and Parser
folder, searched docs.python.org, searched the archived messages of
this group, searched the web, and got absolutely nowhere in finding a
__builtin__.c, or anything that contains the builtin source code.

Help?

What's the 2nd file (in alphabetical order) in the Python folder?
 
B

Ben Finney

John Machin said:
What's the 2nd file (in alphabetical order) in the Python folder?

What is "the Python folder"?

Assuming you mean "the folder for the Python standard library
modules":

$ ls -1 /usr/lib/python2.4/ | head -n 10
aifc.py
aifc.pyc
anydbm.py
anydbm.pyc
asynchat.py
asynchat.pyc
asyncore.py
asyncore.pyc
atexit.py
atexit.pyc

There are no files in that folder with 'builtin' in their name. I'm
don't know what point you're driving at.
 
S

Steven Bethard

Ben said:
What is "the Python folder"?

Assuming you mean "the folder for the Python standard library
modules":

Actually, he meant the folder named 'Python' in the checkout from the
repository:

C:\...\python\2.X>dir Python

Directory of C:\...\python\2.X\Python

03/21/2007 12:13 PM <DIR> .
03/21/2007 12:13 PM <DIR> ..
02/17/2007 03:11 PM 697 asdl.c
03/19/2007 04:31 PM 103,444 ast.c
02/17/2007 03:11 PM 865 atof.c
03/19/2007 04:31 PM 66,286 bltinmodule.c

Probably 'bltinmodule.c' is a good place to start.

STeVe
 
J

John Machin

You snipped the 2nd sentence of what the OP wrote:

""" I searched through the Modules, Objects, Python, and Parser
folder, searched docs.python.org, searched the archived messages of
this group, searched the web, and got absolutely nowhere in finding a
__builtin__.c, or anything that contains the builtin source code. """


He's looking through the *SOURCE* distribution.

What is "the Python folder"?

Assuming you mean "the folder for the Python standard library
modules":

Wrong assumption. You're expecting the source for builtin functions to
be written in Python?
$ ls -1 /usr/lib/python2.4/ | head -n 10
aifc.py [snip]
atexit.pyc

There are no files in that folder with 'builtin' in their name.

I'm
don't know what point you're driving at.

Astonishment that the OP missed it in his serial scan of file names,
even though the name wouldn't be picked up by glob.glob('*builtin*')

BTW there's this ancient gadget called 'grep' that can be used to find
patterns in files, like 'nameofabuiltinfunction('; any semi-usable
editor or IDE would have similar functionality.

Cheers,
John
 
J

John Machin

Actually, he meant the folder named 'Python' in the checkout from the
repository:

C:\...\python\2.X>dir Python

Directory of C:\...\python\2.X\Python

03/21/2007 12:13 PM <DIR> .
03/21/2007 12:13 PM <DIR> ..
02/17/2007 03:11 PM 697 asdl.c
03/19/2007 04:31 PM 103,444 ast.c
02/17/2007 03:11 PM 865 atof.c
03/19/2007 04:31 PM 66,286 bltinmodule.c

Probably 'bltinmodule.c' is a good place to start.

It *was* the 2nd file in the 2.4.3 source I happened to have lying
around on my hard drive :)
 
D

Dustan

What's the 2nd file (in alphabetical order) in the Python folder?

ast.c? But that doesn't help much...

But wait! There's another file... # 4 in the Python folder, which,
naturally following the explicit nature of python, is given the name
"bltinmodule.c".

I don't know how I managed to get more 'a' files than you did,
though... Anyway, thanks for pointing me to the right folder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,789
Messages
2,569,634
Members
45,342
Latest member
Sicuro

Latest Threads

Top