Thanks for the response and the reference, indeed sets and lists behave
differently...
--
https://mail.python.org/mailman/listinfo/python-list
> On 14 Oct 2015, at 23:11, candide via Python-list
> wrote:
>
> If set size changes during a for loop, a runtime exception is raised
A set is a kind of dictionary (without values). And why it can't be resized, is
explained by Brandon Rhodes in his excellent talk 'The Mighty Dictionary',
htt
On Wed, Oct 14, 2015 at 3:11 PM, candide via Python-list
wrote:
> If set size changes during a for loop, a runtime exception is raised:
>
> [SNIP]
>
> Surprisingly, if a for loop changes the size of a list it is iterating on, no
> exception is raised :
>
> [SNIP]
>
> So why lists and sets don't r
If set size changes during a for loop, a runtime exception is raised:
~~
S = {2015}
for z in S:
S.add(42)
~~
~~
Traceback (most recent call last):
File "_.py", line 2, in
for z in S:
RuntimeError: Set