On Sun, 27 Jun 2010 03:38:30 +1000, Lie Ryan wrote: > On 06/27/10 02:33, Thomas Jollans wrote: >>> > >>> > And here's the disadvantages: >>> > >>> > -The Python 3 syntax actually requires more keystrokes. >> Typically ONE extra character: the closing bracket. The opening bracket >> can replace the whitespace previously required. > > What really matters is not the number of extra characters, but the > number of keystrokes. On a typical keyboard, producing a '(' requires 2 > keystrokes (Shift + 9) and another 2 keystrokes for ')' (Shift + 0). > Also, spacebar is a key in the home position of the thumb, while 9 and 0 > are on the top row of the weaker fingers (ring and little finger). > > All in all, the new syntax requires 4 keystrokes, none of which are home > keys; compared with old syntax which requires 1 keystroke in thumb's > home position. > > Producing print function takes a little bit more effort than producing a > print statement.
Worrying about this sort of micro-optimisation is hardly a productive use of anyone's time. Nobody here is complaining that typing len(x) requires three extra keystrokes compared to len x and therefore Python should make len a statement. Why should print be any different? (1) The main use-cases for print are quick (and usually dirty) scripts, interactive use, and as a debugging aid. So this change isn't going to effect many large code bases, but mostly small scripts that can be fairly easily changed by hand. (2) With all the other function calls in Python code, this is a trivial increase in typing effort. (3) If you really care that much, you can re-map your keyboard to make the parentheses require only a single key press. Or use an editor that automatically inserts the closing parenthesis. (4) Despite what the OP says, the ability to overload print is not a small feature, it is a major win. My scripts are filled with ugly functions pr(), print_() or prnt(), depending on how I was feeling at the time, none of which *quite* match the behaviour of the print statement correctly. The ability to redefine print in Python 3 is, to me, the Killer App for simple scripting: _print = print def print(*args, **kwargs): # Untested if "verbosity" not in kwargs: kwargs["verbosity"] = VERBOSITY if kwargs["verbosity"]: del kwargs["verbosity"] _print(*args, **kwargs) # You want logging too? Add it here. The ability to make print() understand your script's --verbose flag is, in my mind, the most underrated plus for Python 3. -- Steven -- http://mail.python.org/mailman/listinfo/python-list