Your message dated Thu, 31 Aug 2017 13:10:25 +0200
with message-id <[email protected]>
and subject line Re: python3: Incoherent "for" behaviour with different 
iterables
has caused the Debian Bug report #861201,
regarding python3: Incoherent "for" behaviour with different iterables
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
861201: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861201
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
this is not a bug. closing.

--- End Message ---

Reply via email to