Python comment stripper

Peter Hansen peter at
Wed Sep 18 00:57:15 EDT 2002

Dennis Reinhardt wrote:
> Does anyone have a Python source comment stripper or can anyone recommend a
> parser that could be adapted for same?
> Why?  ... well there is a better than 2:1 byte size reduction in both raw
> and compressed .py files if comments are stripped.  

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

The only reason to use .py instead of .pyc if size is such an issue
(and with 60GB drives cheap I can't imagine why it would be), is that
you want to maintain access to the source to make changes.  In other
words, to maintain the code.  And maintaining code that has the comments
stripped seems pretty counterproductive, doesn't it?

Or am I missing something?


More information about the Python-list mailing list