[Python-ideas] Verbatim names (allowing keywords as names)
chris.barker at noaa.gov
Thu May 17 13:10:10 EDT 2018
On Wed, May 16, 2018 at 2:09 PM, Carl Smith <carl.input at gmail.com> wrote:
> If your position is that Guido shouldn't introduce keywords that are
> currently used as names at all,
Exactly -- which is why I'm wondering my no one (that I've seen -- long
thread) is presenting the backwards option:
Any new keywords introduced will be non-legal as regular names.
Makes me think that it may have been good to have ALL keywords somehow
non-legal as user-defined names -- maybe ugly syntax, but it would make a
how ugly would this be?
\for i in range(n):
pretty ugly :-(
But maybe not so much if only a handful of new ones....
Or is there another currently illegal character that could be used that
would be less ugly?
I'm actually confused as to what the point is to the \ prefix idea for
* It would still require people to change their code when a new keyword was
* It would be no easier / harder than adding a conventional legal character
-- trailing underscore, or ???
* but now the changed code would no longer run on older versions of python.
I guess it comes down to why you'd want to call out:
"this is a name that is almost like a keyword"
Seems like a meh, meh, lose proposal to me.
OK, I see one advantage -- one could have code that already has BOTH word
and word_ names in it. So when word becomes a keyword, a tool that
automatically added an underscore would break the code. whereas if it
automatically added an currently illegal character, it wouldn't shadow
But a sufficiently smart tool could get around that, too.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas