.py to .pyc

C

Colin J. Williams

Is there some way to ensure that a .pyc file is produced when executing
a .py file?

It seems that for small files the .pyc file is not produced.

Colin W.
 
I

Irmen de Jong

Is there some way to ensure that a .pyc file is produced when executing a .py file?

It seems that for small files the .pyc file is not produced.

Colin W.

All modules no matter how small produce a .pyc file *when they are imported*. If you
start a module directly though, no .pyc is produced. (Notice that Python 3 puts the pyc
files in a subdirectory.)

Why do you care anyway? Pyc files are an implementation detail.

Irmen
 
S

Steven D'Aprano

All modules no matter how small produce a .pyc file *when they are
imported*. If you start a module directly though, no .pyc is produced.
(Notice that Python 3 puts the pyc files in a subdirectory.)

That's only the case for Python 3.2 and higher, not 3.1.

You can also use this:

python -m compileall

to produce .pyc files without waiting for them to be imported.
 
C

Colin J. Williams

Wanna hide his code...?

/Grrr
Curiosity. Perhaps there are stack-based processors out there which
could use the .pyc code more directly.

Colin W.
 
8

88888 Dihedral

Curiosity. Perhaps there are st ack-based processors out there which
could use the .pyc code more directly.

Colin W.

Uhn, don't forget the famous Z-80, and forth CPU which were stack based.
But I am trained in the register based C as my favorite low level language
higher than any assembly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top