PEP 308: "then" "else" for deprecating "and" "or" side effects

Harvey Thomas hst at empolis.co.uk
Fri Feb 14 10:00:01 EST 2003


François Pinard wrote:
> 
> [Christian Tismer]
> 
> > Dear community,
> 
> Nice way to salute! :-)
> 
> > there has been some favor of my silly/simple a then b else 
> c proposal.
> 
> Not so long ago, I added a similar feature in an ad hoc 
> language we created
> for one project (French and specialised syntax, and written 
> under pressure).
> Strangely enough, it did not occur to me, before this 
> morning, that there
> was some relation with this long thread in the Python universe. :-)
> 
> If I translate the keywords of our syntax back to English, it gives:
> 
>     a when b else c
> 
> with a chainable property not requiring parentheses:
> 
>     a when b else c when d else ...
> 
> Our language is declarative (tinily functional) rather than 
> imperative.
> Yet, the above writings are not far from the original Guido 
> suggestion.
> 
> I know I'm merely throwing yet another idea is this already 
> overlong thread,
> which I did not even attempt to read wholly.  Maybe the above has been
> suggested already.  I've no intention whatsoever of pushing 
> or defending it.
> 
> My opinion on PEP 308 is that, whatever is done or not done, 
> the key to the
> final decision should be the continued legibility of the 
> Python language,
> much more than the tiny bit of added functionality.  It just 
> happens that
> for our little language, _not_ Python, the above has been 
> received as quite
> natural and legible by the non-programmers in the project -- 
> they used that
> language heavily for providing that knowledge base the project needed.
> 

+1 to that

I think that to maintain readability we need to add a keyword. As when is surely less likely to be used as a variable name than yield, could we not treat it in the same way as the introduction of generators and for 2.4 one would need
from __future__ import ternary (or similar)

Harvey

_____________________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Scanning Service.





More information about the Python-list mailing list