On Mon, Jun 18, 2012 at 1:23 AM, Devin Jeanpierre <jeanpierr...@gmail.com> wrote: > On Sun, Jun 17, 2012 at 5:54 AM, gmspro <gms...@yahoo.com> wrote: >> >> We know python is written in C. >> C is not portable. > > Badly written C is not portable. But C is probably the most portable > language on the planet, by virtue of basically every system having a C > compiler backend. > > The issue is that a lot of people make nonportable assumptions about > C, and runtimes / OSes / architectures are free to make lots of very > weird decisions. > > For example, this code is not strictly universally-compatible C. It is > "portable" in that the changes required to make it run on any system > are trivial, but not in the sense that it should be able to compile > without any changes. (Not unless a cheeky/smart compiler is involved, > anyway). > > int main () { > return 0; > } > > Instead of 0, it should "technically" return EXIT_SUCCESS AIUI. Most > people don't care because EXIT_SUCCESS is 0 almost everywhere. >
In the interests of pedantry, I will point out that the C standard requires implementation to treat both 0 and EXIT_SUCCESS to be treated as successful exits. The implementation must translate this to whatever the environment treats as successful termination of the program. Ref: specification of the exit(int) function. >> So how does python work on a webserver like apache/httpd for a python >> website? >> How does the intermediate language communicate with server without >> compiling python code? > > Apache is written in C, and can embed CPython. This is easy enough, > because CPython is written in C, and C works well with other C code. > CPython itself can communicate with Python code, because it is > directly responsible for running Python code. So the server > communicates with CPython, and CPython communicates with the Python > code. At no time does Python code ever "directly" touch anything other > than the interpreter. > > > The bytecode doesn't really have much to do with all this, except that > it is the specific thing that CPython works with. > -- regards, kushal -- http://mail.python.org/mailman/listinfo/python-list