[Python-ideas] Verbatim names (allowing keywords as names)
stephanh42 at gmail.com
Thu May 17 13:53:36 EDT 2018
Fortunately we have Unicode bold characters nowadays
𝐢𝐟 if 𝐢𝐧 in:
Look ma! No syntactic ambiguity!
2018-05-17 19:10 GMT+02:00 Chris Barker via Python-ideas <
python-ideas at python.org>:
> 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.
> for instance.
> 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
> clear distinction.
> how ugly would this be?
> \for i in range(n):
> \while \True:
> 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 introduced
> * 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
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas