[Python-Dev] Lockstep iteration - eureka!
Thomas Wouters
thomas@xs4all.net
Wed, 9 Aug 2000 20:28:54 +0200
On Wed, Aug 09, 2000 at 11:40:27AM -0500, Skip Montanaro wrote:
> >> Disadvantages:
> >> It will break that one person's code that uses "indexing" as a
> >> variable name.
> Thomas> This needn't be true, if it's done in the same way as Tim
> Thomas> proposed the 'form from import as as as' syntax change ;)
> Could this be extended to many/most/all current instances of keywords in
> Python? As Tim pointed out, Fortran has no keywords. It annoys me that I
> (for example) can't define a method named "print".
No. I just (in the trainride from work to home ;) wrote a patch that adds
'from x import y as z' and 'import foo as fee', and came to the conclusion
that we can't make 'from' a non-reserved word, for instance. Because if we
change
'from' dotted_name 'import' NAME*
into
NAME dotted_name 'import' NAME*
the parser won't know how to parse other expressions that start with NAME,
like 'NAME = expr' or 'NAME is expr'. I know this because I tried it and it
didn't work :-) So we can probably make most names that are *part* of a
statement non-reserved words, but not those that uniquely identify a
statement. That doesn't leave much words, except perhaps for the 'in' in
'for' -- but 'in' is already a reserved word for other purposes ;)
As for the patch that adds 'as' (as a non-reserved word) to both imports,
I'll upload it to SF after I rewrite it a bit ;)
--
Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!