On Tue, Aug 26, 2008 at 9:23 PM, James Y Knight <[EMAIL PROTECTED]> wrote:

> On Aug 27, 2008, at 12:14 AM, Chris Monson wrote:
>
>>
>> And I think that metaphor is easy to read. Chains of else operators can be
>> useful:
>>
>>   x = f() else g() else h() else 0
>>
>> Not a bad idea.  Looks like the time machine is at work again:
>>
>> x = f() or g() or h() or 0
>>
>
> Well...no. "else" here is significantly different from "or": it only tests
> for None, not falseness.
>
> Correct.

>
> Although, maybe you just meant that "else" and "or" have such similar
> behavior, and their names do not obviously distinguish their behavior. And,
> thus, people would find them confusing, so "else" should not be added to the
> language. That I could agree with.
>
> Unfortunately, I agree that it's confusing because else implies a boolean
value. It doesn't mean that some other analog for the ?? operator wouldn't
be useful. Alternatively, an analog for just the ??= operator would
explicitly address this case:

    arg floob value
is
    arg = value if arg is None else arg

although I'm sure there's a better word than floob. The downside of floob is
that it only addresses this case so not a very convincing argument.

--- Bruce
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to