Re: on slices, negative indices, which are the equivalent procedures?

2021-08-20 Thread Hope Rouselle
Hope Rouselle writes: > Hope Rouselle writes: > >> Dennis Lee Bieber writes: >> >>> On Sun, 15 Aug 2021 00:05:29 -0300, Jack Brandom >>> declaimed the following: >>> Dennis Lee Bieber writes: >>> > subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] > sliceop: ':' [te

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-20 Thread Hope Rouselle
Hope Rouselle writes: > Dennis Lee Bieber writes: > >> On Sun, 15 Aug 2021 00:05:29 -0300, Jack Brandom >> declaimed the following: >> >>>Dennis Lee Bieber writes: >>> >> subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] sliceop: ':' [test] >> >>> >>>This is looking less re

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-20 Thread Hope Rouselle
Dennis Lee Bieber writes: > On Sun, 15 Aug 2021 00:05:29 -0300, Jack Brandom > declaimed the following: > >>Dennis Lee Bieber writes: >> > >>> subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] >>> sliceop: ':' [test] > >> >>This is looking less readable, so, no, I prefer that previous

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-16 Thread Dennis Lee Bieber
On Sun, 15 Aug 2021 00:05:29 -0300, Jack Brandom declaimed the following: >Dennis Lee Bieber writes: > >> subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] >> sliceop: ':' [test] > >This is looking less readable, so, no, I prefer that previous, which was >much clearer about slices.

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-16 Thread Jack Brandom
Dennis Lee Bieber writes: > On Wed, 11 Aug 2021 11:59:11 -0300, Jack Brandom > declaimed the following: > >> >>Where are these production rules coming from? They're not at >> >> https://docs.python.org/3/reference/grammar.html >> >>The word ``stride'' doesn't appear in this grammar. > >

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-13 Thread Michael F. Stemper
On 11/08/2021 20.17, dn wrote: I've been trying to remember if we had negative-steps in FORTRAN do-loops My text for Fortran 77 (the last version that I ever used) says that negative increments are supported. Ref: _FORTRAN 77: Language and Style_; Michael J. Merchant; Wadsworth Publishing Co

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-12 Thread Dennis Lee Bieber
On Thu, 12 Aug 2021 13:17:32 +1200, dn via Python-list declaimed the following: >I've been trying to remember if we had negative-steps in FORTRAN >do-loops especially once the capability to define subscripting-ranges >came 'in' (but can't be bothered researching further). If it was >available, o

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-11 Thread dn via Python-list
On 12/08/2021 10.32, Dennis Lee Bieber wrote: > On Wed, 11 Aug 2021 11:59:11 -0300, Jack Brandom > declaimed the following: >> Where are these production rules coming from? They're not at >> https://docs.python.org/3/reference/grammar.html >> The word ``stride'' doesn't appear in this grammar.

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-11 Thread dn via Python-list
On 12/08/2021 02.59, Jack Brandom wrote: > dn writes: > ... >> Also, whereas I prefer to illustrate 'how it works', I perceive that you >> are used to learning 'rules' and only thereafter their application (the >> teaching-practice under which most of us learned) - so, another reason >> for mixi

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-11 Thread Dennis Lee Bieber
On Wed, 11 Aug 2021 11:59:11 -0300, Jack Brandom declaimed the following: > >Where are these production rules coming from? They're not at > > https://docs.python.org/3/reference/grammar.html > >The word ``stride'' doesn't appear in this grammar. > Possibly from older versions of the g

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-11 Thread Jack Brandom
dn writes: > Apologies for lateness. That's alright. Thanks for the marvelous post. > Coincidentally, I've been asked to speak to our local Python Users' > Group on slicing. Herewith an attempt to modify those demos around your > data/question. Apologies if the result is thus somewhat lacking

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-10 Thread dn via Python-list
Apologies for lateness. Coincidentally, I've been asked to speak to our local Python Users' Group on slicing. Herewith an attempt to modify those demos around your data/question. Apologies if the result is thus somewhat lacking in flow. Also, whereas I prefer to illustrate 'how it works', I percei

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-10 Thread Hope Rouselle
Chris Angelico writes: > On Tue, Aug 10, 2021 at 7:24 AM Jack Brandom wrote: >> >> Greg Ewing writes: >> >> > On 6/08/21 12:00 pm, Jack Brandom wrote: >> >> It seems >> >> that I'd begin at position 3 (that's "k" which I save somewhere), then I >> >> subtract 1 from 3, getting 2 (that's "c", wh

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 7:24 AM Jack Brandom wrote: > > Greg Ewing writes: > > > On 6/08/21 12:00 pm, Jack Brandom wrote: > >> It seems > >> that I'd begin at position 3 (that's "k" which I save somewhere), then I > >> subtract 1 from 3, getting 2 (that's "c", which I save somewhere), then > >> I

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-09 Thread Jack Brandom
Greg Ewing writes: > On 6/08/21 12:00 pm, Jack Brandom wrote: >> It seems >> that I'd begin at position 3 (that's "k" which I save somewhere), then I >> subtract 1 from 3, getting 2 (that's "c", which I save somewhere), then >> I subtract 1 from 2, getting 1 (that's "a", ...), then I subtract 1 f

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-07 Thread Greg Ewing
On 6/08/21 12:00 pm, Jack Brandom wrote: It seems that I'd begin at position 3 (that's "k" which I save somewhere), then I subtract 1 from 3, getting 2 (that's "c", which I save somewhere), then I subtract 1 from 2, getting 1 (that's "a", ...), then I subtract 1 from 1, getting 0 (that's J, ...),

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Chris Angelico
On Sat, Aug 7, 2021 at 5:22 AM Boris Dorestand wrote: > > Jach Feng writes: > > >> > s = "Jack Brandom" > >> > s[3 : -13 : -1] > >> >> 'kcaJ' > >> >> I have no idea how to replace that -13 with a positive index. Is it > >> >> possible at all? > > That's not possible because a positive ind

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Boris Dorestand
Jach Feng writes: >> > s = "Jack Brandom" >> > s[3 : -13 : -1] >> >> 'kcaJ' >> >> I have no idea how to replace that -13 with a positive index. Is it >> >> possible at all? > That's not possible because a positive index is relative to the leftmost item > 0 And the middle index is al

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Jach Feng
> > s = "Jack Brandom" > > s[3 : -13 : -1] > >> 'kcaJ' > >> I have no idea how to replace that -13 with a positive index. Is it > >> possible at all? That's not possible because a positive index is relative to the leftmost item 0 Below is some rules of slice usage which I collected so

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Jack Brandom
"Michael F. Stemper" writes: > On 05/08/2021 12.35, Jack Brandom wrote: >> The FAQ at >>https://docs.python.org/3/faq/programming.html#what-s-a-negative-index >> makes me think that I can always replace negative indices with >> positive >> ones --- even in slices, although the FAQ seems not t

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Michael F. Stemper
On 05/08/2021 12.35, Jack Brandom wrote: The FAQ at https://docs.python.org/3/faq/programming.html#what-s-a-negative-index makes me think that I can always replace negative indices with positive ones --- even in slices, although the FAQ seems not to say anything about slices. With slices, i

on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Jack Brandom
The FAQ at https://docs.python.org/3/faq/programming.html#what-s-a-negative-index makes me think that I can always replace negative indices with positive ones --- even in slices, although the FAQ seems not to say anything about slices. With slices, it doesn't seem to always work. For insta