Proposal: allow '?' and '!' in identifiers

Joshua Marshall jmarshal at mathworks.com
Mon Feb 19 20:25:22 EST 2001


Anybody have any thoughts on allowing the characters '!' and '?' in
identifiers?  It's possible I'm missing something, but I think the
only ambiguity this introduces is in the case of something like the
following:

  a!=b

But whitespace easily disambiguates ("a! = b" vs "a != b").

The only snag I see is in the lexer.  For backward compatibility, "a!=b"
would need to be lexed as "a != b", but this may be unexpected, since the
lexer is currently greedy, trying to make tokens as large as possible
before moving on.

If the addition of '!' as a valid identifier character causes too many
waves, it would still be nice to see '?'.



More information about the Python-list mailing list