Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; '16,': 0.15; 'mon,': 0.15; 'entries.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'seperate': 0.16; 'sortable': 0.16; 'wrote:': 0.16; 'jan': 0.19; 'header:In-Reply-To:1': 0.22; 'interface': 0.23; 'translated': 0.23; 'pm,': 0.26; 'code,': 0.27; 'filter': 0.28; 'lists': 0.28; 'message-id:@mail.gmail.com': 0.28; 'pure': 0.32; 'list': 0.32; "can't": 0.32; 'sort': 0.32; 'to:addr :python-list': 0.33; 'probably': 0.35; 'lists,': 0.35; 'convenient': 0.36; 'two': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:209': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'most': 0.60; 'want,': 0.71; '(one': 0.73 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=+Pz7iNcjIsRIhWqZchmjqBo2UHoO8e6i8gx1xIAFX6E=; b=Hv/n/Bb7H6blBTbKGy5eWTFGVJ1fM1JRcpdZ34zlraxA29gN3J8tcFPmM91xHe6Rda 9in89UtGMj40E5ipOU+JOgTC3Soz5Kgp0L6tzhsn+CYbNCxLoBiVrf+LduLIyGWJbQNa MU5z/zGJ9/hK8yUGMyS75MUuDPIw7uDtGbc/A= MIME-Version: 1.0 In-Reply-To: <67bd5e6b-a332-4d13-aad3-8de88b218ac5@z19g2000vbe.googlegroups.com> References: <67bd5e6b-a332-4d13-aad3-8de88b218ac5@z19g2000vbe.googlegroups.com> Date: Mon, 16 Jan 2012 21:57:59 +1100 Subject: Re: NaN, Null, and Sorting From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1326711481 news.xs4all.nl 6863 [2001:888:2000:d::a6]:52905 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19037 On Mon, Jan 16, 2012 at 9:22 PM, Eelco wrote: > What you want, conceptually, is a > sorted list of the sortable entries, and a seperate list of the > unsorted entries. Translated into code, the most pure solution would > be to filter out the nanas/nulls in their own list first, and then > sort the rest. If the interface demands it, you can concatenate the > lists afterwards, but probably it is most convenient to keep them in > seperate lists. So... you split it into two lists, sort the two lists (one of which can't be sorted), and then concatenate them. Sounds like the quicksort algorithm. ChrisA