walrus with a twist :+= or ...

Avi Gross avigross at verizon.net
Thu Oct 28 14:52:26 EDT 2021


Good points, Peter.

Although we are discussing Python, I think it would be reasonable to look a
bit more broadly.

Ages ago, IBM used a different encoding than ASCII called EBCDIC (Extended
Binary Coded Decimal Interchange Code ) which let them use all 8 bits and
thus add additional symbols. ±  ¦  ¬

So if you chose a specific set of symbols as a subset of UNICODE and
declared it to be PROGRAMMER symbols, it might be possible to provide
special keyboards that had something like the numeric keypad with a few more
symbols or in the place where the F1 keys are or wherever. All programming
languages that wished to use the symbols might be expected to mainly, or
exclusively, only use these symbols for unary or binary operators or other
purposes.

Look at one of the annoyances in Python (and similar in other languages)
where the matched symbols that come in left and right versions are overused.
() is used in oodles of contexts. So is {} and []. We do not use <> as
matching pairs because of other meanings. So a python dictionary and a
python set use the same general notation but can be disambiguated by the
contents sometimes. 

And I note that single and double quotes are currently unique while other
programs like WORD make them in pairs with a clear open and close quote
slanted differently. Would we be better able to write clear constructs if
our programs also clearly marked beginning and ends of text in some
contexts, perhaps allowing even things like nested text?

I have no idea of details here and clearly too many symbols is as bad as too
few. I have taken lots of courses in topics like mathematics and physics
where I was bombarded by all kinds of notations and symbols that forced me
to learn the Greek and other alphabets so I could sort of pronounce them in
my mind, as well as funny "script" letters and all kinds of invented symbols
including many you now find in a wingding section. So having an assortment
of these be the same as used by programmers might be good for others. Think
not just Greek letters that would also give you pi, but the Integral sign
the symbol used for partial derivatives and of course you need an aleph from
Hebrew :=)

Is there a reasonable extension to a keyboard that might be reasonable,
perhaps with an accommodation to those without such a keyboard so that
entering some sequence gets it converted into what you want on the screen
but more mnemonic than 0X234f ??

Now once there was some sort of standard developed, all IDE for all
languages might have the option to adopt it. Of course, some symbols would
not be used or allowed in a particular language, albeit if they were all
otherwise valid UNICODE symbols, would be allowed in other contexts such as
within text or perhaps in variable names.

But back to python, I am not suggesting that it would be wise to modify much
of what exists even if this was available. Sets and Dictionaries might
remain as is, or there might be a second optional way to use them with new
symbols.

I happen to be one of the people who reads/writes/speaks in multiple
languages. Many decades ago I was forced to switch encodings carefully to
say ISO-8859-1 (Latin 1) if I wanted to write properly in German but
Hungarian required ISO 8859-2 and Hebrew needed ISO 8859-8 and Japanese
needed others like Shift JIS. For a while, much of my work included being
able to take in text and perform conversions and it was a royal pain. If
everyone used a small set of common encoding, as in UNICODE, things get
easier from one perspective. What I am suggesting is not as drastic but that
we choose a set of symbols that are clear and unambiguous and not huge but
larger than what we have now and gradually migrate to using more of it.
Obviously brand new languages could be designed to use it and existing
languages MIGHT use it more for new features and extensions. 

So anyone know if anything like I am describing (or something much better)
is being looked at?



-----Original Message-----
From: Python-list <python-list-bounces+avigross=verizon.net at python.org> On
Behalf Of Peter J. Holzer
Sent: Thursday, October 28, 2021 5:08 AM
To: python-list at python.org
Subject: Re: walrus with a twist :+= or ...

On 2021-10-27 22:15:09 -0400, Avi Gross via Python-list wrote:
> But a serious question is now that we sort of have UNICODE, and even 
> many editors and other programs support it, perhaps it might make 
> sense for some operations in computer languages to make use of them.

I have thought so since the 1990's.

But while the large variety of unicode symbols is great for displaying
programs, it is awful for entering them. Keyboards have a limited number of
keys (and those are fairly standardized, if a different standard in each
country), so you either have to combine several keys or need to pick
characters by a different method (e.g. the mouse). Both are cumbersome,
shift the attention of the programmer from the algorithm to the mechanics of
entry, and are different from editor to editor.

I sometimes use Greek letters in variable names. But I do that only for
personal projects, not at work. I can't expect my co-workers to find out how
enter Greek letters in PyCharm or Visual Studio Code or Notepad++ or
whatever they are using and I don't want to do that research myself (I know
how to use digraphs im vim, thank you). And we are a small team.
Think of the diversity in a large multi-national company ...

It might work if the language is tightly integrated with an IDE. Then the
designers of the IDE and the designers of the language can work together to
make it easy to edit programs. And everyone who uses the language has to use
the IDE anyway (because of the tight integration), so "but how do I type
that in Notepad++?" is not a concern.

But tying together a language to an IDE that tightly will turn away all
programmers who are already used to a different IDE (or just plain
editor) and want to continue to use that.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"



More information about the Python-list mailing list