Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: How to get a directory list sorted by date? Date: Sun, 15 May 2016 16:00:03 +0000 (UTC) Lines: 23 Message-ID: References: <20160515061511.7c62b0e1@bigbox.christie.dr> X-Trace: news.uni-berlin.de K26RU7UqaDiMVaF3iPgSQAlQXAN3OTsbY9v3fMDtaY2Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:How': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'missed': 0.15; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'sequence,': 0.16; 'somewhere.': 0.16; 'sorted()': 0.16; 'wrote:': 0.16; '>>>': 0.20; '(or': 0.23; 'tim': 0.24; "i've": 0.25; 'header :User-Agent:1': 0.26; "doesn't": 0.26; 'subject:list': 0.26; 'header:X-Complaints-To:1': 0.26; 'sequence': 0.27; 'correct': 0.28; 'received:24': 0.28; 'function': 0.28; 'chase': 0.29; '15,': 0.30; 'michael': 0.33; 'received:comcast.net': 0.33; 'next': 0.35; 'item': 0.35; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'rather': 0.39; 'to:addr:python.org': 0.40; 'entire': 0.61; 'feeling': 0.72; 'subject:get': 0.81; 'sort.': 0.84; 'edwards': 0.91; 'min': 0.91; 'why?': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: c-24-118-110-103.hsd1.mn.comcast.net User-Agent: slrn/1.0.2 (Linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <20160515061511.7c62b0e1@bigbox.christie.dr> Xref: csiph.com comp.lang.python:108641 On 2016-05-15, Michael Selik wrote: > On Sun, May 15, 2016, 10:37 AM Grant Edwards wrote: >> On 2016-05-15, Tim Chase wrote: >>> >>> unless sorted() returns a lazy sorter, >> >> What's a lazy sorter? > > One that doesn't calculate the next item in the sequence until you > ask for it. It's impossible Why? As long as the function has access to the entire sequence, it should be trivial. Just find the min (or max) item in the sequence, remove it, then return it. It's horribly inefficient, but... > unless you don't mind an approximation rather than correct sort. I have a feeling that I've missed the joke somewhere. -- Grant