Terry Reedy wrote: [...]
> Rick, cut the crap. If you do not understand that > 'something_else()' != 'pass', re-read the tutorial. How is the official tutorial going to give me any insight into an undefined symbol that you invented? Of course, we all understand that "something_else()" is merely a semantical placeholder which is synonomous with "fill_in_the_blank()" or "do_as_you_please()". I'm sure the OP is competent enough to decide when his/her if-clauses need to grow a complementary else-clause, or when a chain of elif-clauses are required as well. My intention was not to make you out as some sort of boogeyman, i simply want to inform those watching. So no need to take any of this personally. > The OP asked: "Why is slicing 'forgiving'?" The current > behavior could be interpreted as 'letting errors pass > silently'. It would be if slicing meant 'give me exactly > the length stop-start subsequence from start to stop (or > raise)'. But slicing actually means 'give me whatever > subsequence exists between start and stop'. Agreed. > My examples attempted to show why this looser definition of > slicing is *useful*. The focus of the third example was > entirely on the condition, not the alternative actions. > (Reminder: either action can be the if-action, and the > other the else-action, depending on how the condition is > written.) True. But your conditional presented a specific binary choice, where the if-clause takes the role of a "TRUTHY_CLAWS", and the else-clause takes the role of a "FALSEY_CLAWS". Unfortunately i didn't get a chance to work FLASEY_CLAWS into my metaphor, hmm, as i was afraid the power dynamic between the two "clawed marsupials" might distract from the narrative. TC always has to be first in everything. That's the way she is, i'm afraid. > I should have mentioned, and others did, that the OP can > write a custom __getitem__ method that implements stricter > slicing for instances of a custom class. Yep. Could name it "StrictSlice". > I think we have collectively answered the OP's question > quite well. Yes. But i like to take advantage of any tangential teaching moments whenever they arise. And don't forget, the OP is not the only person who is learning from this exchange. We are all students of knowledge. -- https://plus.google.com/u/0/collection/UAv9UE -- https://mail.python.org/mailman/listinfo/python-list