[Python-ideas] Crazy idea: allow keywords as names in certain positions
ncoghlan at gmail.com
Mon May 14 00:36:11 EDT 2018
On 13 May 2018 at 14:19, Guido van Rossum <guido at python.org> wrote:
> As anyone still following the inline assignment discussion knows, a
> problem with designing new syntax is that it's hard to introduce new
> keywords into the language, since all the nice words seem to be used as
> method names in popular packages. (E.g. we can't use 'where' because
> there's numpy.where
> and we can't use 'given' because it's used in Hypothesis
> The idea I had (not for the first time :-) is that in many syntactic
> positions we could just treat keywords as names, and that would free up
> these keywords.
While I think the "restricted use" idea would be confusing, I do like the
idea of separating out "postfix keywords", which can't start a statement or
expression, and hence can be used *unambiguously* as names everywhere that
names are allowed.
Adding such a capability is essential to proposing a keyword based approach
to inline assignments, and would technically also allow "and", "or", "is",
and "as" to be freed up for use as names.
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas