On Apr 24, 2007, at 1:39 AM, Antoon Pardon wrote: > On 2007-04-23, Michael Bentley <[EMAIL PROTECTED]> wrote: >> >> On Apr 23, 2007, at 7:38 AM, Antoon Pardon wrote: >> >>> The following is part of the explanation on slices in the >>> tutorial: >>> >>> The best way to remember how slices work is to think of the >>> indices as >>> pointing between characters, with the left edge of the first >>> character >>> numbered 0. Then the right edge of the last character of a string >>> of n >>> characters has index n, for example: >>> >>> +---+---+---+---+---+ >>> | H | e | l | p | A | >>> +---+---+---+---+---+ >>> 0 1 2 3 4 5 >>> -5 -4 -3 -2 -1 >>> >>> This is all very well with a simple slice like: >>> >>> "HelpA"[2:4] => "lp" >>> >>> >>> But it give the wrong idea when using the following extended slice: >>> >>> "HelpA"[4:2:-1] => "Ap" >>> >>> So this doesn't result in the reverse of the previous expression >>> while >>> the explanation above suggest it does. >>> >>> >>> So I suggest to drop this. >> >> But 'drop' means to let or make (something) fall vertically... :-) >> >> At that point in the tutorial, step values had not been discussed. >> Just a bit lower down on the page you'll find a link to 'Sequence >> Types' where you'll find an explanation of stepping you'll perhaps >> find more satisfactory. > > That is very well posible. The question: Even if we get a good > explanation later, do we want an explanation here that can cause > confusion. These things are not just read and then discarded. > Someone can already have read the whole tutorial and then come > back to this place. So at that point he knows about stepping > when he is reading this. > > > I suspect that if you give this explanation to someone and explain > that there is also a step parameter, chances are he will answer > correctly if you ask him, what he thinks the following will result > in: > > > "This is an example line"[12:19:2] > > > > If you ask him what the following will result in: > > "This is an example line"[19:12:-1] > > Chances are he will give the wrong answer.
To be honest, bro -- I'd expect him to have enough intelligence to experiment for a second and figure it out. This isn't rocket science -- you can plainly see what's happening -- so learn it and move on. Or better yet, quietly submit a patch... -- http://mail.python.org/mailman/listinfo/python-list