Execution speed question

Delaney, Timothy (Tim) tdelaney at avaya.com
Tue Jul 29 17:17:07 EDT 2008


Diez B. Roggisch wrote:

>> For sets, I presume they are built on top of or like dicts, and
>> there is nothing crazy in the low level implementation so that I can
>> be guaranteed that if I don't alter the set, then the order,
>> although arbitrary, will be maintained in successive iterations over
>> the contents? 
> 
> It is currently that way, but relying on it is certainly to be
> considered an implementation detail that might disappear without
> warning. 

Fortunately, that's incorrect - it is a documented feature that *so long
as the set is not modified in any way*, iterating over the set will
return the elements in the same order each time.

Tim Delaney



More information about the Python-list mailing list