On 28/01/13 23:52, Antoine Pitrou wrote: > Le Mon, 28 Jan 2013 22:31:29 +1000, > Nick Coghlan<ncoghlan at gmail.com> a écrit : >> >>>> 6. Under "New collections" >>>> >>>> Why both lists and sets? >>> >>> Because pytz did it. But yes, you are right, an ordered set is a >>> better solution. Baseing it on OrderedDict seems like a hack, >>> though. I could implement a custom orderedset, of course. >> >> Sets themselves have an honourable history of just being a thin >> wrapper around dictionaries with all the values set to None (although >> they're not implemented that way any more). Whether you create an >> actual OrderedSet class, or just expose the result of calling keys() >> on an OrderedDict instance is just an implementation detail, though. > > Why the complication? Just expose a regular set and let users call > sorted() if that's what they want. An OrderedSet is not a sorted set. An OrderedSet, like an OrderedDict, remembers *insertion order*, it does not automatically sort the keys. So if datetime needs an ordered set, and I have no opinion on whether or not it really does, calling sorted() on a regular set is not the solution. -- Steven
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