[Python-ideas] Crazy idea: allow keywords as names in certain positions
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>
> > 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
> > about the old days of Fortran (sorry, FORTRAN), which doesn't (didn't?)
> > reserved words at all (nor significant whitespace, apart from the "start
> > 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"
> 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"?
> 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