pyobfuscator.com strips comments, docstrings, and blank lines before encoding your Python code. This preprocessing step is not just a size optimization -- it meaningfully improves the quality of the obfuscated output.
What Gets Stripped
- Line comments: Any line starting with
#-- including file headers, section markers, and inline explanations - Docstrings: Triple-quoted strings at the top of modules, classes, and functions
- Blank lines: Empty lines between blocks that add no semantic value but increase payload size
Why This Matters for Protection
Comments and docstrings are the most valuable targets for a reverse engineer. They contain function descriptions, parameter explanations, algorithm notes, and author information that reveal intent. Stripping them before encoding ensures none of this context survives in the obfuscated payload.
Payload Size Reduction
In heavily documented codebases, comments can account for 30-50% of total line count. Stripping them before compression reduces the Base64 payload length, making the obfuscated file smaller and faster to load.
The Preprocessing Pipeline
pyobfuscator.com applies preprocessing in this order: strip triple-quoted docstrings, strip line comments, remove blank lines, then apply zlib + Base64 + reversal to the cleaned source.
Edge Cases to Be Aware Of
The comment stripper uses a regex-based best-effort approach. A # inside a string literal like a URL is generally handled correctly. However, always test the obfuscated output before deployment to confirm correct behavior.
Disabling Preprocessing
If your code is introspected at runtime via __doc__, you can disable docstring stripping. The obfuscation still applies -- you just retain the docstrings in the encoded payload.