PEP 308: Erik's alternatives list
Erik Max Francis
max at alcyone.com
Sat Feb 22 23:43:13 CET 2003
Bengt Richter wrote:
> On Tue, 18 Feb 2003 18:59:31 -0800, Erik Max Francis <max at alcyone.com>
> >[I also have a list of more generalized
> >schemes -- which could be used as degenerate conditional operators --
> >but as they are really not appropriate for the PEP at hand and open
> >up a
> >huge can of worms, I will not mention them here.]
> A can of worms is good for fishing ;-) Why load prejudice so heavily
> general capability? IMO if a particular ternary syntax generalizes
> into an n-ary form, that is a strength that ought to be considered
Most of the forms suggested extend easily to n-ary capabilities. I
simply neglected to list forms (as a group IV) that _weren't_ solutions
to PEP 308, but were entirely different beasts, like macros, general
lazy evaluation schemes, etc. They may have a particular application
that could be used as a form of a conditional operator
> E.g., you've included
> c -> x -> y
> but there's no way to see that as the minimal ternary form of
> c1 -> expr1 .. c2 -> expr2 .. c3 -> expr3 .. True -> exprDefault
Yes, as I mentioned, I explicitly included forms _that were proposals
for PEP 308_. For brevity I neglected to list all the ways in which
those proposals could be extended to n-ary forms; for instance, I didn't
bother mentioning that (if C: x else: y) extends to (if C: x elif D: y
else: z). Why? Because if we get that far along in the process the
possible forms of extending the syntax to n-ary forms are obvious
I'll also point out that this form you're suggesting here is _not_ what
you originally proposed, so that just underscores the point more. More
generalized forms are an even more amorphous target than a conditional
operator, and that's all we're after in PEP 308.
If you want to propose more general forms like macros or select
expressions, by all means, that can be PEP 308 + n. Right now we're
talking about PEP 308, however.
> n-ary generalization in a future PEP, that is a disadvantage that
> ought to
> be made apparent to voters, even if the PEP does not currently go
> a simple ternary.
The PEP itself _does_ talk about n-way forms for some of the proposals.
The reason there's not much point in talking about n-way extensibility
for every single little proposal (even those which met with no support
whatsoever) is that in most cases it is really obvious.
> Why not?
No one's stopping you from making one yourself.
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ The quality, not the longevity, of one's life is what is important.
\__/ Dr. Martin Luther King, Jr.
Bosskey.net: Return to Wolfenstein / http://www.bosskey.net/rtcw/
A personal guide to Return to Castle Wolfenstein.
More information about the Python-list