On 01/02/2015 18:14, Grant Edwards wrote:
On 2015-02-01, Chris Angelico <ros...@gmail.com> wrote:
On Sun, Feb 1, 2015 at 2:06 PM, Mark Lawrence <breamore...@yahoo.co.uk> wrote:
The one-liner might not be better code, but it must be better speed wise
precisely because it's on one line, right? :)
Well of course it is. Python code speed is always measured in lines
per minute. That's why you should eliminate blank lines from your
code.
No, you've got that backwards. You want _more_ blank lines. A blank
line takes zero time to run, but it still counts as a line in your
lines/second stats.
A loop containing 1 line of code will execute in the same abount of
time as that loop with 1 line of code and 99 blanks lines.
The latter loop is running at 100 times as many lines/second as the
former. That's _got_ to be better.
At long last my quest seeking the final entry for the Zen of Python is
over. I'll be delighted to let you accept the honour of raising an
issue on the bug tracker to get the "this" module changed to reflect my
new found wisdom.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list