A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-February/108424.html below:

[Python-Dev] set iteration order

[Python-Dev] set iteration orderRaymond Hettinger raymond.hettinger at gmail.com
Sun Feb 27 02:30:58 CET 2011
On Feb 26, 2011, at 4:09 PM, Antoine Pitrou wrote:

> On Sat, 26 Feb 2011 10:09:33 +0100
> Hagen Fürstenau <hagen at zhuliguan.net> wrote:
>> 
>> I just hunted down a change in behaviour between Python 3.1 and 3.2 to
>> possibly changed iteration order of sets due to the optimization in
>> issue #8685. Of course, this order shouldn't be relied on in the first
>> place, but the side effect of the optimization might be worth mentioning
>> in "What's new", maybe also pointing out that the old behaviour can be
>> simulated with {x for x in a if x not in b} in place of "a-b".
> 
> I'm against such a mention. It would give the impression that we
> support some semblance of reproduceability in iteration order, which is
> not true. If you use sets or dicts, you must deal with the fact that
> the iteration order will be totally random from your (the programmer's)
> POV.

I concur with Antoine.

Also, it wasn't the iteration order that changed; sets still iterate in the same order.
What changed was the algorithm for creating a new set using a set difference operation.

Raymond
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4