[Python-ideas] A suggestion for Python 3 vs Python 2
Ethan Furman
ethan at stoneleaf.us
Tue Nov 12 11:47:44 CET 2013
On 11/11/2013 09:52 PM, Xuancong Wang wrote:
> You probably ought to weigh the ease of typing against readability. Which is more important? By how much?
Readability, a thousand times.
> As people are used to python2, I don't think changing print to print() will improve code readability by how much,
> especially now VIM already highlights the print command in python. Probably you don't use print in python quite often,
> so you may not sense the difference in typing brackets. If you ever used C/C++/perl frequently, you should sense the
> inconvenience caused by brackets in loop structures.
If you don't like `print()`, do a `p = print` and then all you have is `p()` -- of course, you just lost a bunch a
readability.
But seriously, have often does any real program use print?
> Separately, have you measured typing speed rigorously?
> The typing effort varies from person to person, from beginners to experts, maybe you are too expert to sense the
> difference which is sensitive to beginners. There's no rule-of-thumb and it's not just a speed issue. It's also related
> to energy spent by your fingers. So obviously, pressing 2 keys, you need to spend at least twice the amount of energy.
> And even more if you need to hold down 1 key.
>
> Anyway, I am just introducing an alternative form to the print() function. As long as this does not reduce the
> performance of the interpreter significantly, it should not harm. And it should also improve the downward compatibility.
`print` is now a function, it's now going back to a keyword, and the interpreter loop isn't changing to support such a
tiny use-case.
--
~Ethan~
More information about the Python-ideas
mailing list