On Oct 19, 1:49 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
> Andreas Kraemer <[EMAIL PROTECTED]> wrote:
> >> The only other behaviours I would regard as intuitive for iteration over
> >> a mutating sequence would be to throw an exception either for mutating
> >> the sequence while the iterator exi
Andreas Kraemer <[EMAIL PROTECTED]> wrote:
>> The only other behaviours I would regard as intuitive for iteration over
>> a mutating sequence would be to throw an exception either for mutating
>> the sequence while the iterator exists or for using the iterator after a
>> mutation.
>
> Maybe it wo
On Oct 18, 3:52 am, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Thu, 18 Oct 2007 15:24:27 +1000, Ben Finney wrote:
> > Steven D'Aprano <[EMAIL PROTECTED]> writes:
>
> >> and help(reversed) but neither gives any insight to what happens when
> >> you use reversed() on a sequenc
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
|I don't understand how reversed() is operating. I've read the description
| in the docs:
|
| reversed(seq)
| Return a reverse iterator. seq must be an object which supports the
| sequence protocol (the __len__() method
On Oct 18, 2:25 am, Duncan Booth <[EMAIL PROTECTED]> wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> >> Note that the starting index is determined at creation time, not when
> >> the iteration begins. So, if you create a reversed object over a list
> >> containing 3 elements, the first return
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>> Note that the starting index is determined at creation time, not when
>> the iteration begins. So, if you create a reversed object over a list
>> containing 3 elements, the first returned element will be seq[2],
then
>> seq[1], then seq[0]. It doesn't
On Thu, 18 Oct 2007 15:24:27 +1000, Ben Finney wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> writes:
>
>> and help(reversed) but neither gives any insight to what happens when
>> you use reversed() on a sequence, then modify the sequence.
>
> I would think the answer is the same for any question
On Thu, 18 Oct 2007 02:49:12 -0300, Gabriel Genellina wrote:
> A reversed object is rather simple: it stores the original sequence (a
> reference, as usual, not a copy!) and the next index to use, starting at
> len-1. Each time the next() method is called, the index is decremented
> until it goes
On Oct 17, 9:31 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> I don't understand how reversed() is operating. I've read the description
> in the docs:
>
> reversed(seq)
> Return a reverse iterator. seq must be an object which supports the
> sequence protocol (the __len__() met
En Thu, 18 Oct 2007 01:31:13 -0300, Steven D'Aprano
<[EMAIL PROTECTED]> escribió:
> I don't understand how reversed() is operating. I've read the description
> in the docs:
>
> reversed(seq)
> Return a reverse iterator. seq must be an object which supports the
> sequence protocol (the __len__()
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> and help(reversed) but neither gives any insight to what happens
> when you use reversed() on a sequence, then modify the sequence.
I would think the answer is the same for any question about modifying
sequences while iterating: "undefined, therefore
I don't understand how reversed() is operating. I've read the description
in the docs:
reversed(seq)
Return a reverse iterator. seq must be an object which supports the
sequence protocol (the __len__() method and the __getitem__() method with
integer arguments starting at 0). New in version 2.4
12 matches
Mail list logo