why won't slicing lists raise IndexError?

Python python at bladeshadow.org
Fri Dec 8 11:24:56 EST 2017


On Fri, Dec 08, 2017 at 05:12:35AM -0800, Rick Johnson wrote:
> I have already backed my argument with multiple code
> examples, exhaustive explanations

Which were all false and/or nonsensical.

> >     if item:
> >         process(item)
> >     else:
> >         do_without_item()
> 
> The above code sample is semantically equivalent to the
> following real-life "situational logic":
> 
>     [man sits on couch and enjoys sports programming]
> 
>     if thirsty:
>         grab_beer_from_fridge()
>     else:
>         stay_on_couch()

So what you're ultimately saying is you're making an *assumption* that
the English phrase "do without item" MEANS to do nothing, and
therefore do_without_item() MUST be defined as pass.  However both of
those things are FALSE, and once again your entire argument is
completely invalid.  It's also true that such an assumption is
antithetical to the example.  So, your assumption is both logically
and contextually nonsensical.

If you're on a sinking boat, and you could stop the boat from sinking
if you had a rubber seal, but you don't have one, you're forced to
do_without_item().  Does that mean you're going to sit in the boat and
let it sink with you in it?  By your arguments, apparently YOU must...
But the rest of us would try to fix the leak another way, or failing
that, get the hell out of the boat.  I like our definition of
do_without_item() better.

Ned is right, you just need to be ingored.




More information about the Python-list mailing list