ASCII or Unicode? (was best text editor for programming Python on a Mac)

Steven D'Aprano steve at pearwood.info
Sun Jun 19 23:29:26 EDT 2016


On Mon, 20 Jun 2016 12:07 pm, Rustom Mody wrote:

> If python were to do more than lip service to  REALLY being a unicode age
> language why are things like this out of bounds even for discussion?
> 
> http://blog.languager.org/2014/04/unicoded-python.html

Quote:

"Why do we have to write x!=y then argue about the status of x<>y when we
can simply write x≠y?"

"Simply"?

This is how I write x≠y from scratch:

- press the 'x' key on my keyboard
- grab the mouse
- move mouse to Start menu
- pause and wait for "Utilities" submenu to appear
- move mouse over "Utilities" submenu
- pause and wait for "More Applications" submenu to appear
- move mouse to "More Applications" submenu
- move mouse to "Gnome charmap"
- click
- wait a second
- move mouse to "Character Map" window
- click on "Search" menu
- click on "Find" menu item
- release mouse
- type "unequal" and press ENTER
- press ENTER to dismiss the "Not Found" dialog
- type "not equal" and press ENTER
- press ESC to dismiss the Find dialog
- grab the mouse
- click the ≠ glyph
- pause and swear when nothing happens
- double-click the ≠ glyph
- move the mouse to the "Copy" button
- click "Copy"
- visually search the task bar for my editor
- click on the editor
- invariably I end up accidentally moving the insertion point, 
  so click after the 'x'
- release the mouse
- press Ctrl-V
- press the 'y' key

and I am done.

Now, I accept that some of those steps could probably be streamlined. Better
tooling would probably make it better, e.g. my editor could offer its own
char map, which hopefully wouldn't suck like Open Office's inbuilt "Insert
Special Character" function. It would be nice if the editor keep a cache
of "Frequently Inserted Characters", because realistically there's only a
set of about twenty or thirty that I use frequently.

A programmer's editor could even offer a per-language palette of non-ASCII
operators. Or there could be a keyboard shortcut which I probably wouldn't
remember. If I could remember a seemingly infinite number of arbitrary
keyboard commands, I'd use Emacs or Vi :-)

In theory most Linux apps support an X mechanism for inserting characters
that don't appear on the keyboard. Unfortunately, this gives no feedback
when you get it wrong, and discoverablity is terrible. It's taken me many
years to discover and learn the following:

WIN o WIN o gives °
WIN m WIN u gives µ
WIN s WIN s gives ß
WIN . . gives ·

(WIN is the Windows key)

Getting back to ≠ I tried:

WIN = WIN /
WIN / WIN =
WIN < WIN >
WIN ! WIN =

etc none of which do anything.

Another example of missing tooling is the lack of a good keyboard
application. Back in the 1980s, Apple Macs had a desk accessory that didn't
just simulate the keyboard, but showed what characters were available. If
you held down the Option key, the on-screen keyboard would display the
characters each key would insert. This increased discoverability and made
it practical for Hypertalk to accept non-ASCII synonyms such as

≤ for <=
≥ for >= 
≠ for <>

Without better tooling and more discoverability, non-ASCII characters as
syntax are an anti-feature.



-- 
Steven




More information about the Python-list mailing list