Package: python3 Version: 3.5.3-1 Severity: wishlist Tags: upstream Dear Maintainer,
In this thread (in French), I saw that the for loop behaves differently with sets, lists or frozensets. http://www.les-mathematiques.net/phorum/read.php?15,1446990,1446990#msg-1446990 With a set: >>> ens={1, 2} >>> for i in ens: ... ens.add(i+1) ... Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: Set changed size during iteration With a frozenset: >>> ens=frozenset({1,2}) >>> for i in ens: ... ens=ens|{i+1} ... >>> ens frozenset({1, 2, 3}) All is right, if the iterable is a hashable container, the for loops on a fixed list. Now, with a list: >>> ens=[1, 2] >>> for i in ens: ... ens.append(i+1) ... ^CTraceback (most recent call last): File "<stdin>", line 1, in <module> KeyboardInterrupt >>> len(ens) 14453388 And a tuple: >>> ens=(1,2) >>> for i in ens: ... ens=ens+(i,) ... >>> >>> ens (1, 2, 1, 2) Python should raise a RuntimeError exception with a list as with a set. -- System Information: Debian Release: 9.0 APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 4.3.0-1-686-pae (SMP w/3 CPU cores) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages python3 depends on: ii dh-python 2.20170125 ii libpython3-stdlib 3.5.3-1 ii python3-minimal 3.5.3-1 ii python3.5 3.5.3-1 python3 recommends no packages. Versions of packages python3 suggests: ii python3-doc 3.5.3-1 ii python3-tk 3.5.3-1 pn python3-venv <none> -- no debconf information