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

Lucas Prado Melo lucaspradomelo at gmail.com
Thu Aug 6 20:11:44 CEST 2009


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):
>
> > I just think it looks nicer, and is a good hint that a true/false or
> other
> > kind of flag is likely to come back.
>
> Two problems I immediately see with this:
>
> 1) '?' is punctuation, and uninitiated readers are likely to guess
> that it is some sort of postfix operator.

Actually, Ruby allows this notation and, until now, I have not seen many
complains about it.
Despite that, its use would be pretty clear for the beginner, since it would
be associated with meaningful identifiers:

oil_tank.isItFull?()

The worst problem could be the useless parenthesis after the '?' sign.


> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090806/9e182aa6/attachment.html>


More information about the Python-ideas mailing list