PEP-308 a "simplicity-first" alternative
pyth at devel.trillke.net
Wed Feb 12 05:17:41 CET 2003
Tim Peters wrote:
> [Tim, on Holger's minimal-impact "x and y else z"]
> > Redefining truth used to be easier <wink>: I mentioned it to Guido late
> > afternoon, and his reaction was that it must have been cooked up by
> > someone who spent too much time in this thread.
> [holger krekel]
> > Indeed. Does this reaction indicate anything in particular?
> That he doesn't like it, of course, and that it requires thinking too much
> about it before you can feel comfortable with it.
But after using it a couple of times it reduces the amount of
thinking considerably compared to "x and y or z". And the latter
is what we will stay with, anyway. The more if there is no clear
majority for introducing new expression syntax. Even with new
syntax we will have both cases each one used in dubious contexts.
> Thought experiment:
> suppose you were designing a new language. Would you consider adopting
> Python's "x and y else z" notation for the new language's conditionals? If
> not, then maybe it's a case of settling for too little.
To be honest i wouldn't specifically design a language with ternary
op in mind. It's a "minor feature" probably often better to avoid.
> > Maybe he could help us by outruling some possibilities so we don't spend
> > another 1000 hours (combined) discussing mute issues. We played around
> > to quite some exhaustion already <wink>. From his original PEP I e.g
> > read that he is not ready to introduce a new keyword for a "minor
> > feature".
> > That's still the case i guess.
> It's my part-time job to channel Guido, because he's always overloaded. For
> some reason it doesn't count that I am too <wink>. It occurred to me today
> that the patch Guido wrote two years ago ("if c then a else b"), and the
> suggestion he started with in the PEP last week ("a if c else b"), and the
> newer suggestion he's shown some liking for ("if c: a else: b") have one
> thing in common: they all contain the word "if". As a Professional
> Channeler, my bet is that any spelling that *doesn't* contain "if" is going
> to get rejected in the end for being too obscure. OTOH, "if" says "if" as
> plainly as anything can say "if".
Sure, but they also contain the word "else". To me it's kind of the best
of both current worlds ("and/or" and "if else"). But i am not dutch
(although i work for a dutch company).
> Remember that Guido doesn't want this enough to accept much ugliness in
> order to get it. Indeed, he'd be happy to leave the language alone here.
To me "and/else" is a case of "practicality beats purity". There are tradeoffs
with either approach and no approach at all.
More information about the Python-list