views:

184

answers:

1

Is there a program which I can run like this:

py2py.py < orig.py > smaller.py

Where orig.py contains python source code with comments and doc strings, and smaller.py contains identical, runnable source code but without the comments and doc strings?

Code which originally looked like this:

#/usr/bin/python
"""Do something
blah blah...
"""

# Beware the frubnitz!
def foo(it):
    """Foo it!"""
    print it  # hmm?

Would then look like this:

def foo(it):
    print it
+4  A: 

This Python minifier looks like it does what you need.

Brian Campbell
Excellent. 'minify' was the magic word.
Bo Duke