This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Parser wart
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: jhylton Nosy List: jhylton, rhettinger, tzot
Priority: low Keywords:

Created on 2003-08-27 17:26 by rhettinger, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Messages (2)
msg17985 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-08-27 17:26
Its okay that the parser allows 10+2 to be correctly 
interpreted, but keywords should require whitespace 
separation.  Currently, intervening whitespace is not 
required:

>>> 10and 1
1


msg17986 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2003-08-29 08:29
Logged In: YES 
user_id=539787

History: this wart (keywords legally appended to numeric 
constants, which keywords don't start with 'e', 'f', and 'd' 
perhaps) appears in all languages I have used in my life (well, 
except for the ZX Spectrum 48K Basic, where eg. the 1.5 
keypress for 'and' produced ' and ' forcefully :)

The easiest way would be to have a significant_whitespace 
node in Grammar/Grammar, which would be inserted just 
before the 'and' and 'or' keywords in and_test and or_test, 
but Grammar does not deal with whitespace.  Let's look 
parsemodule.c... could one SIG_WHITESPACE token be 
produced?  Also, what about line continuations having 'and' 
or 'or' in the beginning of a physical line?

I believe this wart should be eliminated only if letter suffixes 
are allowed to numeric constants, which I doubt will happen; 
I'd suggest to lower the priority of this unless somebody finds 
a quick-n-dirty solution.  Not that important.
History
Date User Action Args
2022-04-10 16:10:53adminsetgithub: 39138
2003-08-27 17:26:17rhettingercreate