Boolean tests [was Re: Attack a sacred Python Cow]

Carl Banks pavlovevidence at gmail.com
Wed Jul 30 06:45:40 CEST 2008


On Jul 30, 12:22 am, Erik Max Francis <m... at alcyone.com> wrote:
> Carl Banks wrote:
> > That's not what I was asking for.  I was asking for a use case for "if
> > x" that can't be replaced by a simple explicit test.  Your example
> > didn't satisfy that.
>
> It's a completely artificial request.

Bull.  This is a request, that, if satisfied, would prove that "if x"
is more polymorphic than a simple explicit test.  I posed the question
precisely to see if anyone could come up with a use case that shows
this benefit of "if x".


> "if x" _is_ a completely simple
> test.  Simpler, in fact, than the ones you were advocating.

It's not explicit.

Here's what we know for sure.
1. "if x" uses fewer keystrokes than an explicit test
2. "if x" creates fewer nodes in the parse tree than an explicit test
3. Couple minor things we somehow managed to uncover in this thread

Is that it?  Is that all the benefits of "if x"?  This is what I want
to establish.  A bunch of people in this thread are crowing that it
helps polymorphism, but I have only seen minor examples of it.

I've explained why I doubt that it helps polymorphism that much: you
almost never see code for which an integer and list both work, so
having the ability to spell a test the same way for both types isn't
useful.  If you claim that "if x" does help polymorphism, please tell
me what's wrong with the above analysis.

Or just give me the use case I asked for.


Carl Banks



More information about the Python-list mailing list