You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I noticed that python-minifier, when for example encounters a builtin function used multiple times, assigns it to a variable at the very beginning: E=print
However, when it does so multiple times, they are put each in their own line.
On Windows, a new line consists of a carriage return and line break. It is 2 bytes on its own.
Using a semicolon would take only 1 byte.
How would one go about making this change?
I would make a pull request myself if I find any time to do it myself
I opened this issue to discuss, and point out possible drawbacks of this
(I know that by default it inserts only LINE FEED character, but when porting code across multiple machines this might or might not break?)
The text was updated successfully, but these errors were encountered:
Python itself doesn't care what the line endings are, as long as it's consistent throughout a file. As you said, python-minifier only outputs a linefeed character for newlines.
I haven't ever tested on windows 😬, but I don't think there is any chance of breakage as long as the output file isn't changed to insert a carriage return. I wouldn't recommend manually editing the output on any platform, but I would hope any windows editors follow the newline convention in the file. Even if it doesn't, as long as it replaces all newlines with CRLF it shouldn't break anything.
The idea of using semicolons when possible also came up in #25, for a slightly different reason.
If think it would be good to add a --prefer-semicolons or similar argument to enable this.
A PR would be welcome. It would be a fairly small change but testing can take a long time, so it may take a while to get merged.
Since python-minifier already uglifies the code, I don't see a reason why would one ever want improved readability by using line breaks instead of semicolons. Sure it is sometimes inevitable to use a linebreak though. I'll see what I can do about it in the upcoming days
Hello!
So I noticed that python-minifier, when for example encounters a builtin function used multiple times, assigns it to a variable at the very beginning:
E=print
However, when it does so multiple times, they are put each in their own line.
On Windows, a new line consists of a carriage return and line break. It is 2 bytes on its own.
Using a semicolon would take only 1 byte.
How would one go about making this change?
I would make a pull request myself if I find any time to do it myself
I opened this issue to discuss, and point out possible drawbacks of this
(I know that by default it inserts only LINE FEED character, but when porting code across multiple machines this might or might not break?)
The text was updated successfully, but these errors were encountered: