Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 76 Online
OpenStudy (anonymous):

In one of the first lectures the professor said something about using Python with HTML or something like that, and i was wondering how that was done, is it like Javascript where you basically write

OpenStudy (anonymous):

Well he actually said Python is a compiled language, and JavaScript is an interpreted language.

OpenStudy (anonymous):

oh yeah it's true... ok so I guess I'll have to get better at Javascript xP

OpenStudy (anonymous):

But python is INTERPRETED!

OpenStudy (anonymous):

@338327 No, Python is not interpreted. The standard implementation compiles to bytecode, and then executes in a virtual machine. Many modern JavaScript engines also do this. Regardless of implementation (interpreter, VM, machine code), anything you want can run in the background. You can run shell scripts in the background, if you want.

OpenStudy (anonymous):

Thank you for pasting someone else's response on stack overflow. Really? IDLE itself is a python interpreter. Yes, the code is turned into byte-code, but it's put on a virtual machine. And this virtual machine INTERPRETS the byte code. It's a completely different process from the machine assembly code generated by the C family of programming languages. And anyway, most language implementations are interpreters, can you please give an example of a program which compiles python code?

OpenStudy (anonymous):

@338327 You should really clear your basics. Where did you learn that an interpreter is unable to compile code? Did you ever study the topic compiler design? Lest you say again that I copied I am providing the source, go through it and get your basics right: http://effbot.org/zone/python-compile.htm . Python source code is automatically compiled into Python byte code by the CPython interpreter. Compiled code is usually stored in PYC (or PYO) files, and is regenerated when the source is updated, or when otherwise necessary. The functionality of the interpreter is to compute you semi-stated codes. And lastly if you already know so much, why ask a question at all. If you are so intelligent go out and make the next best software? Who cares?

OpenStudy (anonymous):

I didn't ask this question. Perhaps we are both right, because python is indeed "compiled" into byte code, however, this is only a transparent state that will be put on a virtual machine. The reason I say that it is interpreted is because the byte-code cannot be run directly from machine hardware, and so it must be interpreted half-way. It's the reason python is slower than C++, and why the process to turn a python program into an executable file requires an external plugin, such as py2exe, whereas C code is turned directly into an executable. Yes, byte-code is a lower-level language than python, but it's only half the process.

OpenStudy (anonymous):

Sorry, the compilation is only one of the reasons C and C++ are faster than python.

OpenStudy (anonymous):

@338327 yup you are correct.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
YouMyPlug: A lil sum sum
17 minutes ago 18 Replies 4 Medals
SnowKitty: Can I get some help please
2 hours ago 7 Replies 2 Medals
Coyote: Trigonometry
2 hours ago 3 Replies 2 Medals
Thayes: Listen
4 hours ago 5 Replies 1 Medal
Aubree: Happy birthday @barnbuns! I hope u have a better day!
1 hour ago 15 Replies 3 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!