PEP-308 a "simplicity-first" alternative

Erik Max Francis max at alcyone.com
Wed Feb 12 23:13:39 EST 2003


Christian Tismer wrote:

> Erik Max Francis wrote:
> 
> > And, as I've pointed out through these threads, I think that cure is
> > worse than the disease.
>
> It is in the sense of Tim's way to wrap the objects
> into objects with a truth value of true, and having
> an ifelse function that picks it out again, just
> avoiding that step.
> 
> def ifelse(thing): return thing[0]
> 
> ifelse(C and [x] or [y])

This works, of course, but is no new surprise, it's mentioned in the
FAQ.  It's highly unreadable, however.

> Both solutions indicate that the truth value association
> of objects isn't always to fortunate.

> But why is this cure worse than the desease?

Look very closely at Bengt's actual proposal, and then ask me that
question again.

He's talking about patching the broken and/or syntax with a special
form, {x} (which he writes with curly braces, already confusing) that
evaluates as True in some circumstances, and something else (x) in
others.  I'd like him to try to even explain that one to a newbie. 
Hell, I'd like to see him try to explain that one with a formal grammar
and fully describe its semantics.

It's just replacing an unreadable idiom with an even more unreadable
one.

> What is you way to cure the desease (which exists)?

	if C: x else: y

I'd also be able to tolerate

	C then x else y

and a handful of other forms to lessening degrees.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Will I disappoint my future / If I stay
\__/ Sade
    Bosskey.net: Return to Wolfenstein / http://www.bosskey.net/rtcw/
 A personal guide to Return to Castle Wolfenstein.




More information about the Python-list mailing list