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

Masklinn masklinn at masklinn.net
Tue Aug 11 21:56:24 CEST 2009

On 11 Aug 2009, at 21:09 , Georg Brandl wrote:
> Masklinn schrieb:
>> On 11 Aug 2009, at 19:33 , Georg Brandl wrote:
>>> Masklinn schrieb:
>>>> On 11 Aug 2009, at 15:25 , Arnaud Delobelle wrote:
>>>>> On 11 Aug 2009, at 11:43, Antoine Pitrou wrote:
>>>>> Steven D'Aprano <steve at ...> writes:
>>>>>>> What makes you think that the question mark is a clue-in that a
>>>>>>> yes/no
>>>>>>> answer is expected?
>>>>>> AFAIK it is a widely-used convention in the Ruby world.
>>>>>> I'd even go as far as saying that it's quite pretty, as a
>>>>>> typographical
>>>>>> convention (not that other Ruby conventions are :-))
>>>>> Also in Scheme. (I think the question mark more or less replaces  
>>>>> the
>>>>> 'p' suffix used in LISP).
>>>> It does, and Ruby's idea of using the "?" postfix for boolean query
>>>> (instead of an `is` or `is_` prefix) comes from there.
>>> But, and I believe that was Steven's point, it is no more than a
>>> convention.
>> It isn't, any more than Python's `_` prefix convention, or its `self`
>> argument for that matter. I'd heard the Python community was pretty
>> big on smart conventions but I might be wrong.
> But what is the advantage of "?" to "is_" then?
I think it's easier to spot due to 1. being a fairly rare character in  
programs (in languages where the ?: ternary doesn't exist anyway) and  
2. being at the end of the call (though on Python method the ()  
operator makes that much less interesting, if you aren't using a  

is_ is less easy to spot as it's a pretty unremarkable sequence of  
characters and at the middle of the call/line.

More information about the Python-ideas mailing list