|
|
 |
 |
 |
 |
Python Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
Where's the source code for __builtin__?
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?
On 25/04/2007 9:32 AM, Dustan wrote: > 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?
John Machin <sjmac @lexicon.net> writes: > On 25/04/2007 9:32 AM, Dustan wrote: > > 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. > 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. -- \ "Oh, I love your magazine. My favorite section is 'How To | `\ Increase Your Word Power'. That thing is really, really, | _o__) really... good." -- Homer, _The Simpsons_ | Ben Finney
Ben Finney wrote: > John Machin <sjmac @lexicon.net> writes: >> On 25/04/2007 9:32 AM, Dustan wrote: >>> 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. >> 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":
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
On 25/04/2007 12:31 PM, Ben Finney wrote: > John Machin <sjmac @lexicon.net> writes: >> On 25/04/2007 9:32 AM, Dustan wrote: >>> 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.
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'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":
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.
And when you get to <source_distribution>/Python, you'll find that that's still the case :-) > 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
On 25/04/2007 1:17 PM, Steven Bethard wrote:
> Ben Finney wrote: >> John Machin <sjmac @lexicon.net> writes: >>> On 25/04/2007 9:32 AM, Dustan wrote: >>>> 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. >>> 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": > 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 :-)
On Apr 24, 7:52 pm, John Machin <sjmac@lexicon.net> wrote: > On 25/04/2007 9:32 AM, Dustan wrote: > > 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?
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.
|
 |
 |
 |
 |
|