[Guido van Rossum] <snip> > > My current approach (now in CVS!) is to remove the sort_repr flag to > the constructor, but to provide a method that can produce a sorted or > an unsorted representation. __repr__ will always return the items > unsorted, which matches what repr(dict) does. After all, I think it I just updated my CVS copy and I like your implementation. +1 from me for how you are handling it. > could be confusing to a user when 'print s' shows > > Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) > > but > > for i in s: print i, > > prints > > 9 8 7 6 5 4 3 2 1 0 > Good point. As Fran?s pointed out, newbies do expect dicts to always come out in the same order (and I must say that I, like Fran?s, have never seen any docs saying that it does always come out the same order as long as nothing has mutated) and I would expect that expectation to carry over to sets. -Brett C.
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