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

Arnaud Delobelle arnodel at googlemail.com
Tue Aug 11 15:25:15 CEST 2009


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).
A noun, adjective or verb followed by a question mark is pretty  
obviously a predicate:

    number?
    empty?
    restart?

I expect them all to return a boolean.

-- 
Arnaud




More information about the Python-ideas mailing list