dflook / python-minifier

Transform Python source code into its most compact representation
MIT License
553 stars 40 forks source link

better detection for whether or not it is safe to minify variable names #92

Open mqyhlkahu opened 1 year ago

mqyhlkahu commented 1 year ago

python-minifier does a few checks to ensure that it's safe to minify variables. I've gathered a short list of things which should probably be checked for, along with the checks that already exist. This won't entirely prevent problems with identifier minifying, but it will prevent many of the more-common gotcha's.

builtins:

These can be checked for in the same way that locals(), globals(), and the rest are checked for.