Feature suggestion -- return if true

Grant Edwards invalid at invalid.invalid
Tue Apr 12 09:42:32 EDT 2011


On 2011-04-12, James Mills <prologic at shortcircuit.net.au> wrote:
> On Tue, Apr 12, 2011 at 12:18 PM, Grant Edwards <invalid at invalid.invalid> wrote:
>> You stated that
>>
>> ??return? <expr>
>>
>> was equivalent to
>>
>> ??return <expr> or None
>
> This is _not_ what I said.
>
> Quoting from my earlier post:
>
> """
>>    return? expr
>
> This syntax does not fit well within python ideology.
>
>> be expanded to
>>
>>    _temp = expr
>>    if _temp: return _temp
>
> This could be simplified to just:
>
> return expr or None
> """

You just said it again: that the OP's "return? expr" is the same as
"return exrp or None".  It isn't.  The OP's construct didn't return
if expr wasn't true.  Your construt does.

> Please read carefully before putting words in my mouth.

I wasn't putting words in your mouth.  You said the same thing again
in the post to whic I'm replying.

> I stated very clear y that return? expr didn't seem fitting
> in the python ideology as syntax for this behavior.

I don't care about syntax.  What you proposed doesn't have the same
_semantics_ as what the OP proposed.

-- 
Grant Edwards               grant.b.edwards        Yow! I'd like MY data-base
                                  at               JULIENNED and stir-fried!
                              gmail.com            



More information about the Python-list mailing list