[Python-ideas] Verbatim names (allowing keywords as names)

Paul Moore p.f.moore at gmail.com
Wed May 16 04:13:52 EDT 2018

On 16 May 2018 at 01:41, Steven D'Aprano <steve at pearwood.info> wrote:
> Inspired by Alex Brault's  post:
> https://mail.python.org/pipermail/python-ideas/2018-May/050750.html
> I'd like to suggest we copy C#'s idea of verbatim identifiers, but using
> a backslash rather than @ sign:
>     \name
> would allow "name" to be used as an identifier, even if it clashes with
> a keyword.

I'm missing something. How is that different from using a trailing
underscore (like if_ or while_) at the moment? I understand that foo
and \foo are the same name, whereas foo and foo_ are different, but
how would that help? Can you give a worked example of how this would
help if we wanted to introduce a new keyword? For example, if we
intended to make "where" a keyword, what would numpy and its users
need to do to continue using `numpy.where`?


More information about the Python-ideas mailing list