Newbie: Python + C Question

laotseu bdesth at removethis.free.fr
Wed Apr 9 15:39:40 EDT 2003


Peter Hansen wrote:
> laotseu wrote:
> 
>>bourassa wrote:
>>
>>>When Python uses the C extension does it just process
>>>it in an interpreted fashion
>>
>>Python is not a C interpreter.
>>
>>
>>>or does the code written in C run like a
>>>compiled C program?
>>
>>newbie to programming, uh ?-)
>>
>>How do you think this all works ?
> 
> 
> Actually, to be fair to the OP, this is a valid and even interesting
> question.  Where, after all, does it say that the C code that is
> in the extension is actually pre-compiled into an executable and
> is run as machine code when called by Python?  (Maybe it's there
> in the docs, but maybe it's not or maybe it's unclear.  Have you
> checked?)

Personnaly, no. BTW I didn't mean to be harsh (and I do apologize if it 
could be taken this way, the fact is that my english is somewhat limited 
so I can't always express my thoughts as clearly as I would like).

The fact is that most of Python docs seems to take for granted that 
everybody kons at least what are a compiled language, an interpreted 
language, byte-code, machine code etc... And the fact is that most 
programmers knows at least enough about those topics to get the picture. 
Hence my reflexion about the OP being newbie to programming in general.

> I could picture someone believing that Python had the ability to
> execute C code interpretively via some fancy C-interpreter
> extension, which would allow the existing code-base of C to be 
> used within an otherwise-pure-Python program.  

I must admit I never personnally imagined such a thing before reading 
the OP question ! BTW, most of the 'existing code-base of C' being 
mainly distributed as binaries, I think the misleading part of it is the 
'C extension' term itself.

Laotseu





More information about the Python-list mailing list