Re: Sets vs lists loop behaviour if size changes

2015-10-14 Thread candide via Python-list
Thanks for the response and the reference, indeed sets and lists behave differently... -- https://mail.python.org/mailman/listinfo/python-list

Sets vs lists loop behaviour if size changes

2015-10-14 Thread candide via Python-list
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