Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Reg Python Byte code

Reply
Thread Tools

Reg Python Byte code

 
 
praba kar
Guest
Posts: n/a
 
      08-22-2005
Dear All,

Python 2.3 creates byte code with *.pyc
extention. But Python 2.4 creates bytes code with
*.pyo. Is there any difference between *.pyc
and *.pyo?.

Actually After python compiled a program
then that program will run from the *.pyc byte
code. If I delete that byte code what will be
happen.?

If I delete *.pyc byte code in the python
2.3 then It will create again *.pyc byte code.
But If I delete *.pyo byte code in the python
2.4 then It will not create again *.pyo. Why
this difference.

If I delete byte code of the python.
I want to know Whether it will affect the
performance of the programme or not.

Kindly clear me all the doubts regarding
byte code of python.

with regards
Prabahar








__________________________________________________ __
Send a rakhi to your brother, buy gifts and win attractive prizes. Log on to http://in.promos.yahoo.com/rakhi/index.html
 
Reply With Quote
 
 
 
 
Magnus Lycka
Guest
Posts: n/a
 
      08-22-2005
praba kar wrote:
> Python 2.3 creates byte code with *.pyc
> extention. But Python 2.4 creates bytes code with
> *.pyo. Is there any difference between *.pyc
> and *.pyo?.


Since way back, ordinary Python bytecode uses .pyc,
and optimized Python bytecode (python -O) uses .pyc.
This has nothing to do with Python versions. As I
recall, Python installers on the most common platforms
have pre-generated both .pyc and .pyo file for the
standard library since before 2.3.

> Actually After python compiled a program
> then that program will run from the *.pyc byte
> code. If I delete that byte code what will be
> happen.?


Python will have to compile the module again, the
next time it's imported.

> If I delete *.pyc byte code in the python
> 2.3 then It will create again *.pyc byte code.
> But If I delete *.pyo byte code in the python
> 2.4 then It will not create again *.pyo. Why
> this difference.


Because you didn't use 'python -O'. It used the
..pyc version, not the .pyo. It's there too!

> If I delete byte code of the python.
> I want to know Whether it will affect the
> performance of the programme or not.


There is little point in removing files that
will come back again. If you're allergic to
bytecode files, you can writeprotect those
dictionaries though. Each python process that
imports a module will then have to compile the
module. Whether this affects performance depends
on how you use Python. For long runinng tasks,
it will probably not matter, for e.g. big CGI
scripts, it might have severe implications.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
find out whther byte two .pyc files contain the same byte code. gelonida Python 1 05-05-2010 11:04 PM
Windows Reg Pro vs Tweak now Reg Cleaner vs Registry fix, vs RegCleaner jl Computer Support 3 05-31-2005 12:53 AM
connection 1: transfer chunk 1 (byte 0 to byte 1024) Jean-Daniel Gamache Java 0 07-14-2004 03:57 AM
Single byte addressable, multiple byte readout. Andreas VHDL 1 05-04-2004 01:49 PM
Appending byte[] to another byte[] array Bharat Bhushan Java 15 08-05-2003 07:52 PM



Advertisments