[Python-ideas] Syntax idea: escaping names to avoid keyword ambiguity

Daniel Moisset dmoisset at machinalis.com
Mon May 14 10:44:20 EDT 2018


On 14 May 2018 at 15:02, Clint Hepner <clint.hepner at gmail.com> wrote:

>
> > On 2018 May 14 , at 6:47 a, Daniel Moisset <dmoisset at machinalis.com>
> wrote:
> >
> > Following up some of the discussions about the problems of adding
> keywords and Guido's proposal of making tokenization context-dependent, I
> wanted to propose an alternate way to go around the problem.
>
> My main objection to what follows is that it doesn't seem to offer any
> benefit over the current practice of appending an underscore (_) to a
> keyword to make it a valid identifier.
>
>
A secondary benefit I forgot to mention in my previous reply (and which is
not covered by adding an underscore suffix) is that the original name being
preserved it's better for interfacing with external systems that may use
those names:

For example, this code:
https://github.com/dsc/pyquery/blob/fd725469701a8f47840f142df5c9b6d4479ea58e/pyquery/pyquery.py#L584
(and some code below that) is essentially a workaround that is required
because they used a "_" suffix ibecause it's hard to pass "class" or "for"
as keys in **kwargs

-- 
<https://www.machinalis.co.uk>
Daniel Moisset
UK COUNTRY MANAGER

A:   1 Fore Street, EC2Y 9DT London <https://goo.gl/maps/pH9BBLgE8dG2>
P:   +44 7398 827139 <+44+7398+827139>
M:   dmoisset at machinalis.com <dmoisset at machinalis.com>  |   S:   dmoisset
<http://www.linkedin.com/company/456525>
<http://www.twitter.com/machinalis>  <http://www.facebook.com/machinalis>
<https://www.instagram.com/machinalis.life/>
Machinalis Limited is a company registered in England and Wales. Registered
number: 10574987.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180514/dcd3017f/attachment.html>


More information about the Python-ideas mailing list