for -- else: what was the motivation?

Antoon Pardon antoon.pardon at vub.be
Sun Oct 16 06:17:39 EDT 2022


Op 16/10/2022 om 00:50 schreef avi.e.gross at gmail.com:
> This has been discussed so often precisely because I swear NO CHOICE of keyword would satisfy everybody! Most languages start with designated keywords and some reserve a few for later use. But then things can get frozen in place to avoid breaking existing programs or break older compilers/interpreters.
>
> Some languages use techniques to extend themselves more harmlessly such as creating a singleton object that has content that can be regular data as in math.pi, or functions/methods or new ides like "Symbols" that allow all kinds of extensions to the language in a fairly harmless way as no older program would likely have used features that did not exist.
>
> 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.

Python could slowly transition in this direction by first allowing the 
current keywords to be in this block. Every new keyword would only be in 
that unicode block. If would then be possible to write python code with 
this convention but it wouldn't be obligatory. After some time the 
python developers could decide to make it obligatory.

I doubt this will idea will get from the ground, but I think it would 
allow for a smoother transition into new concepts, as it is no longer a 
strugle searching for a keyword that will break as little programs as 
possible.

-- 
Antoon Pardon.


More information about the Python-list mailing list