confused with so many python package locations for imports

Chris Rebert clp2 at rebertia.com
Sat Apr 25 23:34:33 CEST 2009


On Sat, Apr 25, 2009 at 1:31 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
> Krishnakant <hackingkk at gmail.com> writes:
>
>> My Basic question is that, what package directory is Standard as far
>> as all gnu/linux distros are concerned?
>
> Python has a habit of generating, and expecting to find,
> platform-specific files (‘foo.pyo’ extension modules)

Erm, .pyo-s aren't platform-specific. According to
http://docs.python.org/dev/tutorial/modules.html#compiled-python-files
:

When the Python interpreter is invoked with the -O flag, optimized
code is generated and stored in .pyo files. The optimizer currently
doesn’t help much; it only removes assert statements.

Passing two -O flags to the Python interpreter (-OO) will cause the
bytecode compiler to perform optimizations that could in some rare
cases result in malfunctioning programs. Currently only __doc__
strings are removed from the bytecode, resulting in more compact .pyo
files.

A program doesn’t run any faster when it is read from a .pyc or .pyo
file than when it is read from a .py file; the only thing that’s
faster about .pyc or .pyo files is the speed with which they are
loaded.


It's not like .pyo-s are compiled C extension modules.

Cheers,
Chris
-- 
I have a blog:
http://blog.rebertia.com



More information about the Python-list mailing list