[Python-ideas] Crazy idea: allow keywords as names in certain positions

Elias Tarhini eltrhn at gmail.com
Sun May 13 14:50:57 EDT 2018


Apologies for my initial response. Looks like I failed to expand the
initial email fully, which would have shown me the following :)

> Of course this would still not help for names of functions that might be
imported directly (do people write 'from numpy import where'?).

-- I do think the *import keyword as keyword_* concept has merit, however.

(This would also be a simple retroactive solution to the asyncio.async
problem, wouldn't it?)

On Sun, May 13, 2018, 11:45 AM Chris Angelico <rosuav at gmail.com> wrote:

> On Mon, May 14, 2018 at 4:19 AM, Guido van Rossum <guido at python.org>
> wrote:
> > 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.
> > ...
> > I should also mention that this was inspired from some messages where Tim
> > Peters berated the fashion of using "reserved words", waxing
> nostalgically
> > about the old days of Fortran (sorry, FORTRAN), which doesn't (didn't?)
> have
> > reserved words at all (nor significant whitespace, apart from the "start
> in
> > column 7" rule).
>
> I spent most of the 1990s coding in REXX, which has exactly zero
> reserved words. You can write code like this:
>
> if = 1
> then = "spam"
> else = "ham"
>
> if if then then
> else else
>
> do = 5
> do do
>     print("Doobee doobee doo"
> end
>
> The problem is that you can go a long way down the road of using a
> particular name, only to find that suddenly you can't use it in some
> particular context. Common words like "if" and "do" are basically
> never going to get reused (so there's no benefit over having actual
> keywords), but with less common words (which would include the
> proposed "where" for binding expressions), it's entirely possible to
> get badly bitten.
>
> So the question is: Is it better to be able to use a keyword as an
> identifier for a while, and then run into trouble later, or would you
> prefer to be told straight away "no, sorry, pick a different name"?
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180513/8d636891/attachment.html>


More information about the Python-ideas mailing list