A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-February/033118.html below:

[Python-Dev] Re: Trinary Operators

[Python-Dev] Re: Trinary Operators [Python-Dev] Re: Trinary OperatorsAahz aahz@pythoncraft.com
Thu, 6 Feb 2003 15:36:32 -0500
On Thu, Feb 06, 2003, Guido van Rossum wrote:
>Gerald S. Williams:
>>
>> I'm an even-day fan of trinary operators myself, but this opens too
>> many questions. For example, with regard to short-circuiting, it will
>> be inconsistent with other expressions at some level in either form
>> or function.
>
> How so?  If we give 'or' (and hence 'and') a higher priority --
> i.e. binding tighter -- than 'if' and 'else', it's unambiguous to the
> parser and also consistent with the if statement:
> 
>   if x and y:
>      print 1
>   else
>      print 0
> 
> means the same as
> 
>   print 1 if x and y else 0
> 
> This is also similar to how lambda groups relative to and/or (and/or
> has a higher priority).

Are they really equivalent?  What about

    print h() if f() and g()

versus

    if f() and g():
        print h()

Does g() get called if f() is false?  What about h()?
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Argue for your limitations, and sure enough they're yours."  --Richard Bach



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4