4 ms·
Only in Python can I commit a whitespace-only change that results in a 10x speed improvement.
by jdblair 8y ago
Only in Python can I commit a whitespace-only change that results in a 10x speed improvement.
- b_tterc_p 8y agoCare to explain? I’m not sure where this would work without fundamentally changing the meaning of the code
- notacoward 8y agoI'm guessing it refers to moving something out of a loop, which in Python often requires only an indentation change. In most other languages, it requires moving the code to the other side of a brace, or perhaps adding a brace. If braces were considered whitespace, which is not entirely unreasonable when talking about Python vs. other languages, it would be much harder to come up with examples. Drawing a blank right now. Anyone else want to try?
- jdblair 8y agoThat correct. It was a case of nested loops and some code that was in the wrong loop. Braces are most definitely not whitespace, even if they serve the same function as whitespace in Python.