Unicode in Python
Steven D'Aprano
steve at pearwood.info
Wed Apr 23 03:53:00 EDT 2014
On Tue, 22 Apr 2014 23:57:46 -0700, Rustom Mody wrote:
> On the other hand when/if a keyboard mapping is defined in which the
> characters that are commonly needed are available, it is reasonable to
> expect the ∨,∧ to cost no more than 2 strokes each (ie about as much as
> an 'A'; slightly more than an 'a'. Which means that '∨' is expected to
> cost about the same as 'or' and ∧ to cost less than an 'and'
Oh, a further thought...
Consider your example:
return year%4=0 ∧ (year%100≠0 ∨ year%100 = 0)
vs
return year%4=0 and (year%100!=0 or year%100 = 0)
[aside: personally I like ≠ and if there was a platform independent way
to type it in any editor, I'd much prefer it over != or <> ]
Apart from the memorization problem, which I've already touched on, there
is the mode problem. Keyboard layouts are modes, and you're swapping
modes. Every time you swap modes, there is a small mental cost. Think of
it as an interrupt which has to be caught, pausing the current thought
and starting a new one. So rather than:
char char char char char char char ...
you have:
char char char INTERRUPT
char INTERRUPT
char char char ...
which is a heavier cost that it appears from just counting keystrokes. Of
course, the more experienced you become, the smaller that cost will be,
but it will never be quite as low as just a "regular" keystroke.
Normally, when people use multiple keyboards, its because that interrupt
cost is amortized over a significant amount of typing:
INTERRUPT (English layout)
paragraph paragraph paragraph paragraph
INTERRUPT (Greek layout)
paragraph paragraph paragraph
INTERRUPT (English again)
paragraph ...
and possibly even lost in the noise of a far greater interrupt, namely
task-switching from one application to another. So it's manageable. But
switching layouts for a single character is likely to be far more
painful, especially for casual users of that layout.
Based on an extremely generous estimate that I use "lambda" four times in
100 lines of code, I might use λ perhaps once in a thousand non-Greek
characters. Similarly, I might use ∧ or ∨ maybe once per hundred
characters. That means I'm unlikely to ever get familiar enough with
those that the cost of two interrupts per use will be negligible.
--
Steven
More information about the Python-list
mailing list