Python comment stripper

Dennis Reinhardt DennisR at dair.com
Wed Sep 18 10:41:40 EDT 2002


> This doesn't seem like a good reason to me.  Why not just use .pyc files
> all the time and be done with it?

I am looking to package Python programs as EXE files for upload/download
over the internet.  The "good reason" is faster upload/download over dialup
lines, not hard disk space.  Consider the situation at developer and
recipient systems:

On developer machine: .py files are copied to a staging directory and
comments stripped in the staging directory.  The original .py files are not
changed and so maintenance is not an issue.  The eventual output of process
is a single EXE compressed file, uploaded to internet..

On recipient machine: compressed EXE file is downloaded via internet.  When
run, the EXE contents are automatically unpacked to a temporary directory,
The temporary directory is deleted at conclusion of running the EXE.
Recipients will do nothing with the comments, especially since they are
bound inside the EXE.

See www.dair.com/hellopy.exe for an example (Windows platform only, sorry)
which has imported os.py.  The example is 361 Kb.  It could be smaller still
if the comments are stripped.  This matters more and more if library files
are included since the uncompressed size of the lib directory is about 1.9
Mb.

--

Dennis Reinhardt

DennisR at dair.com
http://www.dair.com





More information about the Python-list mailing list