[Python-ideas] Make all keywords legal as an identifier
Cameron Simpson
cs at zip.com.au
Tue Apr 26 09:15:04 CEST 2011
On 25Apr2011 14:26, Ethan Furman <ethan at stoneleaf.us> wrote:
| haael wrote:
| >First of all, many nouns are reserved, i.e. "object" or "class".
|
| Many? Aren't we still at less than 50 words total? Pretty
| infinitesimal when compared with the 100,000+ words in the English
| language.
|
| >Second: variable names are usually nouns indeed, but functions and
| >methods are often verbs, while named parameters can be
| >prepositions and adverbs. [...]
| >Python kidnapped many verbs and prepositions and made them reserved.
|
| See above. This is a ridiculous exaggeration.
Though to be fair, Python's using a fair number of the very heavily used
ones.
Personally I'm -1 on the proposal, especially the leading dot part.
One downside that springs to mind is a weakness in C: the syntax is
so... lexically complete... that quite often a syntactic programming
error can get warnings about well below the actual error, and several
easy mistakes are syntacticly valid and only show as logic errors later.
The standard example is = instead of ==.
My point here is that the more valid but mistaken forms the language
allows, the easier it is for simple errors to become logic errors.
Contrived examples:
# getting the "as" name from "foo"
from foo import as
# but did I mean "from foo import this as that" ?
# is this now a syntax error, since "as" is a name?
with open("foo") as fp:
Cheers,
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
The worst tyrannies were the ones where a governance required its own logic on
every embedded node. - Vernor Vinge
More information about the Python-ideas
mailing list