for -- else: what was the motivation?

Peter J. Holzer hjp-python at hjp.at
Sun Oct 16 16:26:50 EDT 2022


On 2022-10-16 19:52:47 +0200, Antoon Pardon wrote:
> Op 16/10/2022 om 19:01 schreef Peter J. Holzer:
> > On 2022-10-16 12:17:39 +0200, Antoon Pardon wrote:
> > > Op 16/10/2022 om 00:50 schreefavi.e.gross at gmail.com:
> > > > That might not easily solve this problem. But I wonder if reserving
> > > > some kind of prefix might help, so anything like extension.0nNoBreak
> > > > could be added to a loop as a final clause and be treated as a
> > > > non-key keyword of sorts.
> > > My idea would be to reserve different unicode blocks for the keywords and
> > > the identifiers. e.g. We could reserve the mathematical alphanumeric block
> > > for keywords and all other letters and numbers for identifiers. Doing so
> > > would allow extenting the keywords without breaking programs that already
> > > use that combination as an identifier.
> > Or you could go back to the old Algol idea of underlining keywords.
> > 
> > Both have the same problem, though: They make editing with an ordinary
> > text editor pretty much impossible. You need a language-aware IDE which
> > makes entering these characters or markups simple.
> 
> That is not true with my idea. The editor would just need to be able
> to work with unicode characters. Vim can work with 𝐝𝐞𝐟 just as it can
> with def.

Yes, vim can. But can the user? And the user's system?

And vim isn't the only editor out there. So you need a system for every
editor some Python programmer might want to use. While most will
probably use a sufficiently powerful editor, some won't.

> In vim I can also define abbreviations so that whenever I type ^Bd vim
> wil insert 𝐝𝐞𝐟 for me.

Which requires the user to define and type abbreviations. Which may be
hard if they can't enter the characters in the first place (Ok, that may
not be a problem as most users will probably just install a package from
the internet,)

The same does work with underlines:

d̲e̲f̲

although weirdly my terminal underlines the wrong characters (the one to
the right instead of the one to the left).

The pragmatic action would of course to define "def" as an abbreviation
for "𝐝𝐞𝐟" (or "d̲e̲f̲"), but then what have you won?

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20221016/8eaf65d1/attachment.sig>


More information about the Python-list mailing list