Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108646

Re: How to get a directory list sorted by date?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: How to get a directory list sorted by date?
Date Mon, 16 May 2016 07:52:19 +1000
Lines 27
Message-ID <mailman.3.1463349148.19823.python-list@python.org> (permalink)
References <vmpl0d-l9n.ln1@esprimo.zbmc.eu> <nh9gh6$ekb$1@ger.gmane.org> <20160515061511.7c62b0e1@bigbox.christie.dr> <nha1h2$r6s$1@ger.gmane.org> <CAGgTfkPfL2e419iMLP1012q10x-6dG3vaWDvaTFyPUyMrXh3Kw@mail.gmail.com> <nha6e3$2ij$1@ger.gmane.org> <CAPTjJmpOaYOBunq7_uANGzZNMkv7W4gKFB=0Wtw_M0qLEhEWkQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de /NHIDedpWkOhW0ZyPMqofgFASCTqdJl8ZqgO1N/wumog==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; '16,': 0.03; 'cc:addr :python-list': 0.09; 'subject:How': 0.09; 'missed': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sequence,': 0.16; 'somewhere.': 0.16; 'sorted()': 0.16; 'wrote:': 0.16; 'memory': 0.17; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; '(or': 0.23; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; "i've": 0.25; "doesn't": 0.26; 'subject:list': 0.26; 'message-id:@mail.gmail.com': 0.27; 'sequence': 0.27; 'correct': 0.28; 'function': 0.28; 'chase': 0.29; 'sure,': 0.29; '15,': 0.30; 'generally': 0.32; 'point': 0.33; 'michael': 0.33; 'usually': 0.33; 'received:google.com': 0.35; 'next': 0.35; 'received:74.125.82': 0.35; 'item': 0.35; 'but': 0.36; 'should': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'log': 0.38; 'rather': 0.39; 'entire': 0.61; 'more': 0.63; 'feeling': 0.72; 'subject:get': 0.81; 'chrisa': 0.84; 'sort.': 0.84; 'to:none': 0.91; 'edwards': 0.91; 'min': 0.91; 'want!': 0.91; 'why?': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=wNdeQbIVW5QlsDqzUU5mwZJ+Sj/IwgNhVDZC3e4vHwc=; b=cL8Vo9Vno2TMwyaw7E0OGXmMWGGyRRymCEUktl0ENzhqNc/4dcS8GuZ/U9FQNBv1gK Xs8v4vJVTxFBSHX3dhRp3wDNPyCPHEXSeL4hjXEt0VXq7XmOKhRVKY4gnKzEoOrKwzkX BKSahTv89rh+3B0ziTCiJs7MQ3SIhgtuSMLoHLIrH1NYrPR9ASEYow0o/0CJPPFlIBFH jCN+GVEHTkLKVhIJ52WSfeFDpKCAQFAF17ebRvbGrdqq4/gpIVG3u6yU6vwTkzLzDw8k tzonfP0IzAu53REb6YMpowBNYt0qfynjEZxCGhuYwlxziPuSfLEA+6kxVob2AdVvLtTs OCeg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=wNdeQbIVW5QlsDqzUU5mwZJ+Sj/IwgNhVDZC3e4vHwc=; b=ltsCiEe9GLmkZw8xX5TBjVfIyE11jqOKoq3Z/GX/5a+BGF37HjwVlqqMxzIyhnBgiL tHhiqFpLxQIyoC/hsXEOIfRMPoFxgGqJ46prhk1A9Xhy7GlmEVfr+d0mXFzRFgCBEGPC UHI1t/wHRCUNQJ3JtDlHEXjzWCFnF62FrNyZFykHVDxZV4QqWXBd5/TuUuLkBR33uZyk LVC1yjC+fd50niujA2pVMRcIb4l18vPO9nH+8Jw+xUxmgwtABZB1t3uYCdYy3o7Qj4Bv 28xRx2dRQbf/YNU4KC7jkprfjhbKBxbJbmt8L2HQp/S9prnKfYXsoQsw4VEr6c2FH2q1 1Leg==
X-Gm-Message-State AOPr4FV0PmHhfuuqf3sFncgtWL/DRVqN+mk9rzS+MfFK7EZSdElJjO6XuA180KyQpOGOORg3OhbvZ9dbb14xYQ==
X-Received by 10.28.126.145 with SMTP id z139mr13845191wmc.81.1463349139876; Sun, 15 May 2016 14:52:19 -0700 (PDT)
In-Reply-To <nha6e3$2ij$1@ger.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAPTjJmpOaYOBunq7_uANGzZNMkv7W4gKFB=0Wtw_M0qLEhEWkQ@mail.gmail.com>
X-Mailman-Original-References <vmpl0d-l9n.ln1@esprimo.zbmc.eu> <nh9gh6$ekb$1@ger.gmane.org> <20160515061511.7c62b0e1@bigbox.christie.dr> <nha1h2$r6s$1@ger.gmane.org> <CAGgTfkPfL2e419iMLP1012q10x-6dG3vaWDvaTFyPUyMrXh3Kw@mail.gmail.com> <nha6e3$2ij$1@ger.gmane.org>
Xref csiph.com comp.lang.python:108646

Show key headers only | View raw


On Mon, May 16, 2016 at 2:00 AM, Grant Edwards
<grant.b.edwards@gmail.com> wrote:
> On 2016-05-15, Michael Selik <michael.selik@gmail.com> wrote:
>> On Sun, May 15, 2016, 10:37 AM Grant Edwards <grant.b.edwards@gmail.com> wrote:
>>> On 2016-05-15, Tim Chase <python.list@tim.thechases.com> 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.

Sure, it's not impossible to implement, but generally the point of
lazy generation is that it's more efficient. Going from O(N log N)
with O(N) memory to O(N*N) with O(1) memory is not usually what you
want!

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to get a directory list sorted by date? cl@isbd.net - 2016-05-15 09:47 +0100
  Re: How to get a directory list sorted by date? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-15 20:48 +1000
  Re: How to get a directory list sorted by date? Michael Selik <michael.selik@gmail.com> - 2016-05-15 15:50 +0000
  Re: How to get a directory list sorted by date? Grant Edwards <grant.b.edwards@gmail.com> - 2016-05-15 16:00 +0000
  Re: How to get a directory list sorted by date? Tim Chase <python.list@tim.thechases.com> - 2016-05-15 13:12 -0500
    Re: How to get a directory list sorted by date? cl@isbd.net - 2016-05-15 21:23 +0100
  Re: How to get a directory list sorted by date? Chris Angelico <rosuav@gmail.com> - 2016-05-16 07:52 +1000
  Re: How to get a directory list sorted by date? Random832 <random832@fastmail.com> - 2016-05-16 12:40 -0400

csiph-web