On Sat, Jun 2, 2018 at 9:10 AM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>>
>> if you 'break' immediately after a mutation, that isn't
>> continuing to iterate. Even though you're inside the loop, there's no
>> further action taken to process the loop, and no problem.
>
>
> Yes, but you're als
Chris Angelico wrote:
if you 'break' immediately after a mutation, that isn't
continuing to iterate. Even though you're inside the loop, there's no
further action taken to process the loop, and no problem.
Yes, but you're also not calling next() again, so no
exception would be triggered.
My po
On Thu, 31 May 2018 16:37:39 +0200, Frank Millman wrote:
[...]
> Agreed, but my gut feel, and the following example, suggest that when
> processing the last key in a dictionary while iterating over it, you
> have not yet stopped iterating.
>
d = {}
d[1] = 'one'
d[2] = 'two'
Before
"Gregory Ewing" wrote in message news:fnccd8ff3s...@mid.individual.net...
Chris Angelico wrote:
> It is an error to mutate the dictionary *and then continue to iterate
> over it*.
But if you're processing the last key, and you add one so
that it's no longer the last key, what should happen?
On Fri, Jun 1, 2018 at 4:56 PM Gregory Ewing
wrote:
> Chris Angelico wrote:
> > It is an error to mutate the dictionary *and then continue to iterate
> over it*.
>
> But if you're processing the last key, and you add one so
> that it's no longer the last key, what should happen?
>
> My feeling is
On Fri, Jun 1, 2018 at 5:54 PM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>>
>> It is an error to mutate the dictionary *and then continue to iterate over
>> it*.
>
>
> But if you're processing the last key, and you add one so
> that it's no longer the last key, what should happen?
>
> My feeli
Chris Angelico wrote:
It is an error to mutate the dictionary *and then continue to iterate over it*.
But if you're processing the last key, and you add one so
that it's no longer the last key, what should happen?
My feeling is that this should be an error, because it's
not clear whether itera
On Fri, Jun 1, 2018 at 12:37 AM, Frank Millman wrote:
> "Steven D'Aprano" wrote in message news:peorib$1f4$2...@blaine.gmane.org...
>>
>>
>> On Thu, 31 May 2018 10:05:43 +0200, Frank Millman wrote:
>>
>> > From the interpreter session below, you will see that adding a key while
>> > processing th
"Steven D'Aprano" wrote in message news:peorib$1f4$2...@blaine.gmane.org...
On Thu, 31 May 2018 10:05:43 +0200, Frank Millman wrote:
> From the interpreter session below, you will see that adding a key while
> processing the *last* key in an OrderedDict does not give rise to an
> exception.
I
On Thu, 31 May 2018 10:05:43 +0200, Frank Millman wrote:
> "Frank Millman" wrote in message news:pemchs$r12$1...@blaine.gmane.org...
>>
>> So working backwards, I have solved the first problem. I am no nearer
>> to
> figuring out why it fails intermittently in my live program. The message
> from
"Frank Millman" wrote in message news:pemchs$r12$1...@blaine.gmane.org...
So working backwards, I have solved the first problem. I am no nearer to
figuring out why it fails intermittently in my live program. The message
from INADA Naoki suggests that it could be inherent in CPython, but I am n
11 matches
Mail list logo