PEP-308 a "simplicity-first" alternative
Erik Max Francis
max at alcyone.com
Wed Feb 12 20:52:59 EST 2003
Paul Paterson wrote:
> The form is best shown by example since the x, y, C nomenclature can't
> be
> written with all the symbols meaning the same thing as in your other
> examples (which is why I goofed and switched the spelling of x and y
> between
> posts).
Uh, why can't they? C is the conditional test, x is the expression to
evalute if it is true, y is the one to evaluate if false. Whether or
not you're crazy about the choice of symbols, that is utterly
unambiguous.
> val = sqrt(x) or "imag" if x < 0
>
> is the same as,
>
> if x >= 0:
> val = sqrt(x)
> else:
> val = "imag"
So your proposal is
y or x if C
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ If you can't fight and you can't flee, flow.
\__/ Robert Elliot
Physics reference / http://www.alcyone.com/max/reference/physics/
A physics reference.
More information about the Python-list
mailing list