end of print = lower productivity ?
Tim Chase
python.list at tim.thechases.com
Tue Nov 25 11:44:31 EST 2008
>>>>> p = print
>>>>> p("f")
>> Voila, 4 keystrokes saved :-)
>
> When I write "print", it is both effortless and instantaneous : my
> hands do not move, a wave goes through my fingers, it all happens in a
> tenth of a second.
>
> Contrast this with what one has to go through to catch the SHIFT key,
> and then the "(" : move the left hand, press SHIFT, move the right
> hand, aim "(", press, miss, press again. Same thing at the end of the
> function call.
>
> I know it sounds ridiculous, but it does *impair* my debugging
> productivity. Taylor would agree.
It's not so much "rediculous" as a failure of your editor to
assist you. In Vim (my editor-of-choice), I'd do something like
:iab print print()<left><bs>
and that's the end of it. Or you could be even lazier if you
don't name your variables "p":
:iab p print()<left>
in which case you can just type
p"
and it automatically populates with
print(")
with the cursor after the double-quote ready for you to type the
string's contents. Net gain: 5 characters in old-Python and 6
characters in new-Python ;-)
Any editor environment worth its salt should allow you to do
things like this (insert abreviated text or template text). The
gains made from making "print" a function far outweigh niggling
things that simple editor-tweaks can overcome.
-tkc
More information about the Python-list
mailing list