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

Tim Rowe digitig at cix.co.uk
Tue Mar 6 19:17:00 CET 2001


In article <uwvakgkx5.fsf at cs.uu.nl>, piet at cs.uu.nl () wrote:

> >>>>> Joshua Marshall <jmarshal at mathworks.com> (JM) writes:
> 
> JM> Christoph Horst <rc-bashar at gmx.net> wrote:
> >> Nathaniel Gray <n8gray at caltech.edu.is.my.email.address> wrote:
> >>> IMHO it's not worth adding "!", but if "?" doesn't break anything 
> > then it's >>a net gain.  I assert that it _would_ make Python more 
> > expressive to add an >>elegant way of indicating that a function 
> > returns only boolean values.
> 
> >> What's wrong with prefixing the function name with 'is'?
> 
> JM> I wouldn't say anything is wrong with that approach.  But then I 
> > could
> JM> also ask "Why do we need underscores as valid identifier characters?
> JM> You can just capitalize the next letter."
> JM> The question mark is an unused character, and carries some
> JM> natural-language meaning.  It's useful.
> 
> Please don't do it. There are more useful things to do with ? like the
> ternary operator for conditional expressions.
> -- 
> Piet van Oostrum <piet at cs.uu.nl>
> URL: http://www.cs.uu.nl/~piet [PGP]
> Private email: P.van.Oostrum at hccnet.nl

But please not in Python. One of the things that makes Python so clean, 
AFAICS is that it has /very/ few notations that are not remarkably close 
to their natural language meanings -- even (), [] and {} evoke some notion 
of grouping. ".", "!=", "==", sadly with 2.x "+=" etc, but still 
remarkably few. Anyway, the ternary operator is deprecated in every C/C++ 
style guide I have ever seen, so it's hardly a good reason to muddy the 
clarity of the language.



More information about the Python-list mailing list