On 06/20/2012 07:30 PM, gmspro wrote: > Hi, > > Is python a interpreted or compiled language? > What does happen after this command: python f.py > > I knew python makes file.pyc file to store the bytecode. For java , .class > file is the bytecode file, someone can run that file from any machine. So is > the .pyc file executale like java? > > Can anyone please explain/elaborate the process/order of executing python > file with example? > > Thanks. > Ian has given you a good answer. But since you mention java, I'd like to point out a few things that are different between the two environments. He and I are describing CPython; jython and other implementations don't use .pyc files, and they behave differently.
java has available a "runtime" environment, for those who don't want or need the compiler. CPython comes with the compiler and the runtime bundled together. Java's classfile remains stable over a number of compiler versions, while CPython doesn't seem to worry about that. Java's classfile has been targeted by a number of other byte code compilers, including jython. Code from any of those libraries may use the java libraries. With java, one has to explicitly compile the java code, while with CPython, the runtime logic compiles imported modules if they're not already compiled. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list