Re: ZTK 2.0: Deprecate zope.sequencesort
Lennart Regebro <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Message-ID | <CAL0kPAUQgJax25Crqfb0LFnrRP_1qmK6euGq8wKL=Q=aLQiXGQ@mail.gmail.com> |
On Fri, Mar 1, 2013 at 7:06 PM, Suresh V. <[email protected]> wrote: > On Friday 01 March 2013 02:15 PM, Lennart Regebro wrote: >> >> I'm sorry, it's early in the morning. It is of course: >> >>> sorted(sorted(news_stories, key=lambda x: x.publication_date, >>> reverse=True), key=lambda x: x.category) >> >> > > Won't the two sorteds step over each other? Nope. Timsort is a stable sort, so you get a list that is sorted first by category and then by publication_date. //Lennart _______________________________________________ Zope-Dev maillist - [email protected] https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )