Bug#861201: python3: Incoherent "for" behaviour with different iterables

2017-04-25 Thread Florian Bruhin
On Tue, Apr 25, 2017 at 09:55:01PM +0200, Dominik George wrote: > Hi, > > > Python should raise a RuntimeError exception with a list as with a set. > > It *does*, for a list. > > But in Python 3, with [], you do not get a list, but an iterator with a > list-like API ;). It wraps a list which yo

Bug#861201: python3: Incoherent "for" behaviour with different iterables

2017-04-25 Thread Dominik George
Hi, > Python should raise a RuntimeError exception with a list as with a set. It *does*, for a list. But in Python 3, with [], you do not get a list, but an iterator with a list-like API ;). It wraps a list which you add to, but __next__ will yield the next item if there is one. -nik

Bug#861201: python3: Incoherent "for" behaviour with different iterables

2017-04-25 Thread Nicolas Patrois
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}