Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Mar 29 04:51:04 CET 2014


On Fri, 28 Mar 2014 16:18:25 -0500, Mark H Harris wrote:

> We need a standard input system not controlled by Microsoft where-by
> everyone in the entire world can enter unicode (with customization)
> easily and inexpensively. A unicode keyboard would be nice.

Under what circumstances do you see yourself needing a keyboard capable 
of typing Hindi?

I don't wish to pay for a keyboard for entering Arabic when I'm never 
going to enter more than two or three Arabic characters at a time. If I 
need to enter an Arabic character, I can use one of many existing virtual 
keyboards. If I decide to learn Arabic, I will use my current keyboard 
(perhaps with new keycaps) and switch to a different keyboard layout.

I don't think that an English-speaker who needs to occasionally enter a 
few characters like © ¢ or £, a mathematician who knows TeX, a Russian 
wanting to type in Cyrillic, and a Japanese writer who needs to swap 
between four different writing systems (Kanji, Hiragana, Katakana, and 
Rōmaji) are all going to be well-suited by any one system. I expect that 
it will end up being one-size-fits-none.


> Why must
> everyone in the world be stuck with a U.S. Royal typewriter keyboard for
> two or three hundred years? 

You are being patronising to the 94% of the world that is not from the 
USA. Do you honestly think that people all over the world have been using 
computers for 30 or 40 years without any way to enter their native 
language? Before trying to speak for everyone in the world, it would be a 
good idea to learn something about their situation first.

People are not stuck with the US Royal typewriter keyboard. Keyboards are 
localised all over the world. I'm not just talking about European 
keyboards mostly similar to US keyboards but with a few customizations. 
I'm talking about keyboards for entering Chinese and Japanese:

http://www.keysourcechina.com/chinese-keyboard.html
http://www.stanford.edu/class/cs140/projects/pintos/specs/kbd/jp106.jpg

although I'm pretty sure this is a joke:

http://propelsteps.boards.net/thread/27/creative-chinese-keyboard-2000-symbols


When you install Linux, one of the first things the installer asks you to 
do is choose a keyboard layout. The choices are *not* just:

US Qwerty
US Dvorak

but one of a large variety of keyboard layouts. On my system, there are a 
least 95:

[root at ando ~]# ls /usr/share/X11/xkb/symbols | wc -l
95

Likely many more, as most of the files contain more than one layout; e.g. 
the ru file contains 5, the fr file contains 7.

On Mac and Windows, locally-bought systems will come pre-configured for 
the local national language.

You can even buy keycaps for some pretty niche use-cases:

http://www.maxkeyboard.com/r4-1x1-cherry-mx-chinese-astrology-animal-sign-keycap-set.html

although I expect that's more for novelty reasons than anything else.

Most languages work quite well with the standard keyboard layout of four 
rows of keys, plus modifiers and special keys. Japanese and Chinese are 
probably the two hardest cases (apart from languages that don't even have 
a writing system!), and even they have solutions to the problem of 
computer input. (In Japan, many people don't even use Unicode, at least 
not yet, so your hypothetical solution wouldn't help them one bit.)

Virtually all keyboards today have standardized on a similar layout, one 
with at least three modifier keys (and more commonly four). People with 
specialized needs can configure their keyboard the way it suits them. 
There's no need for some dictator or committee to declare that everyone 
will use this system or that. Historians who need to enter Phoenician 
characters can do so, the rest of us don't need to worry about them.

Relevant: https://en.wikipedia.org/wiki/Space-cadet_keyboard


> Dvorak had the right idea; but it didn't
> stick (although I have a Dvorak key mapping I use (with emacs) just for
> fun).

Dvorak is an American English system. There are modified versions to suit 
other languages with additional characters, but it is essentially 
*identical* to Qwerty except for the order that the keys appear. 
Shuffling the order that Latin letters ABC...Z appear on the keyboard is 
not in any way "the right idea" for entering non-Latin languages, nor 
does a Dvorak language help enter arbitrary Unicode characters.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/



More information about the Python-list mailing list