[Python-Dev] Re: ternary operators (fwd)

Ka-Ping Yee ping@lfw.org
Mon, 31 Jan 2000 22:29:40 -0600 (EST)


On Mon, 31 Jan 2000 gvwilson@nevex.com wrote:
> So I asked Simon Peyton-Jones and Phil Wadler how languages other than C
> and its derivatives did conditional expressions; one of the replies was:
> 
> On Mon, 31 Jan 2000, Philip Wadler wrote:
> 
> > Tony Hoare had a nice ternary `if'.  He writes
> >
> > 	if c then d else e
> >
> > as
> > 
> > 	d <c> e

Wait -- how the heck is this supposed to parse if 'c' is an
arbitrary expression?

I think we've run out of bracket-like thingies.  (Yes, that
would be the technical term).

It also looks pretty opaque -- even if you do intuit that
it's ternary-select (which i wouldn't if you hadn't told me)
it still isn't really obvious which side is which.


-- ?!ng