470,604 Members | 2,226 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,604 developers. It's quick & easy.

python pyc or pyo files

hi

any good websites or articles that describes about pyc or pyo files ,
how they are generated and what's the difference between them and
Java's bytecode??
thanks

Apr 20 '06 #1
4 2750
"mi*******@hotmail.com" wrote:
any good websites or articles that describes about pyc or pyo files ,
how they are generated and what's the difference between them and
Java's bytecode??


they're described in the Python tutorial:

http://docs.python.org/tut/node8.htm...00000000000000

the difference between PYC files and java byte code is that PYC files
contain Python byte code, not Java code, and that Python generates
them on the fly, without any need for an explicity compile step.

if you want Java byte code for your Python programs, use Jython.

http://www.jython.org/

</F>

Apr 20 '06 #2
thanks !
can i ask again...
I have two scripts , A.py and B.py
In B.py, i have an import statement to import A.py
When i executed B.py, i saw a A.pyc in the same directory, but not
B.pyc ....
This is an expected behaviour right? why is B.pyc not generated?

thanks

Apr 20 '06 #3
mi*******@hotmail.com wrote:
This is an expected behaviour right? why is B.pyc not generated?


PYC files are only generated for modules that are imported, not for
toplevel scripts. also see:

http://pyfaq.infogami.com/how-do-i-create-a-pyc-file

</F>

Apr 20 '06 #4
thanks! got it

Apr 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

699 posts views Thread by mike420 | last post: by
2 posts views Thread by Roose | last post: by
10 posts views Thread by Andrew Dalke | last post: by
5 posts views Thread by Michael Sperlle | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.