PEP308: Yet another syntax proposal

Anton Muhin antonmuhin at sendmail.ru
Mon Feb 10 11:04:33 EST 2003


Raymond Hettinger wrote:
> I suggest:
> 
>     cond  ??  val1  ||  val2
> 
> * Having two characters at each step helps visually segregate the
> components.
> * The ?? and || strongly suggest testing and alternation.
> * Doesn't overload or confuse with existing operators.
> * No new keywords.
> * In-order presentation.
> * Short and easy to read.
> 
> 
> Using Martin Maney's live code examples, here's what it looks like:
>     i = j>=0 ?? j || n
>     sy = d0.year - (d0.month<7  ??  1  ||  0)
>     add2url = '?' + (params.has_key('add2url')  ??  params['add2url']  ||
> '')
>     tail = (len(events)>1 ??  ' '  ||  '<br>') + tail
> 
> 
> Raymond Hettinger
> 
> 
It seems almost ideal for me :)

Anton.





More information about the Python-list mailing list