[Python-ideas] What about allowing '?' in method names?

Stephen J. Turnbull stephen at xemacs.org
Fri Aug 7 05:07:09 CEST 2009

Lucas Prado Melo writes:
 > On Thu, Aug 6, 2009 at 12:16 PM, Greg Falcon <veloso at verylowsodium.com>wrote:
 > > On Wed, Aug 5, 2009 at 9:01 PM, Tennessee
 > > Leeuwenburg<tleeuwenburg at gmail.com> wrote:
 > > > def shouldSomethingHappen?(self, context):

 > Actually, Ruby allows this notation and, until now, I have not seen many
 > complains about it.

So does Lisp.  But those languages simply allow ? as part of an identifier.

Python, for one thing, envisions syntax extensions.  Sometimes these
are done with keywords, of course, but sometimes it makes sense to use
an operator (as with decorators' use of "@").  Reserving all
punctuation for this purpose is a reasonable heuristic.

I suspect that the BDFL pronounced simply on the basis that there are
plenty of alternatives (trailing "Q" as Tennessee suggested, trailing
"_p" per Ben) so the benefit is minute, while the costs would be

 > > 2) IPython gives a special meaning to ?, and it would be a shame to
 > > collide with that.
 >  IMHO, IPython might not be mature enough to interfere with Python design
 > decisions yet.

It already has, IIRC.  ISTR IPython was a consideration, though not a
showstopper, in the choice of "@" for decorators.

More information about the Python-ideas mailing list