[Python-Dev] re: conditional expressions

Greg Wilson Greg.Wilson@baltimore.com
Wed, 17 Oct 2001 10:46:45 -0400


I just showed the proposed conditional expression syntax
to two colleagues, and asked them how they would write
the "sign" function (-1 for negative, 0 for zero, +1 for
positive) using it.  Both of them wrote:

    s = if x < 0 then -1 elif x == 0 then 0 else 1

(Well, OK, one of them tested negative, then positive, then
returned zero as the 'else', but that's a quibble.)  I think
most users will expect 'elif' to work in expressions, just
as it does in statements; is this already part of the new 
syntax?

Thanks,
Greg


-----------------------------------------------------------------------------------------------------------------
The information contained in this message is confidential and is intended 
for the addressee(s) only.  If you have received this message in error or 
there are any problems please notify the originator immediately.  The 
unauthorized use, disclosure, copying or alteration of this message is 
strictly forbidden. Baltimore Technologies plc will not be liable for direct, 
special, indirect or consequential damages arising from alteration of the 
contents of this message by a third party or as a result of any virus being 
passed on.

In addition, certain Marketing collateral may be added from time to time to 
promote Baltimore Technologies products, services, Global e-Security or 
appearance at trade shows and conferences.
 
This footnote confirms that this email message has been swept by 
Baltimore MIMEsweeper for Content Security threats, including
computer viruses.