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


Groups > comp.lang.python > #108643

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

From Tim Chase <python.list@tim.thechases.com>
Newsgroups comp.lang.python
Subject Re: How to get a directory list sorted by date?
Date 2016-05-15 13:12 -0500
Message-ID <mailman.0.1463338938.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> <20160515131232.200268cf@bigbox.christie.dr>

Show all headers | View raw


On 2016-05-15 14:36, Grant Edwards wrote:
> On 2016-05-15, Tim Chase <python.list@tim.thechases.com> wrote:
> > unless sorted() returns a lazy sorter,
> 
> What's a lazy sorter?

A hypothetical algorithm that can spool out a sorted sequence without
holding the entire sequence in memory at the same time. 

Though I typed that initial reply a little quickly, as I hadn't known
at the time that scandir()'s results also provide stat() results with
reduced overhead (whereas listdir() just returns the filenames, so
you have to stat() each one).  Thanks, Peter, for highlighting this
feature.

So in light of my newfound knowledge, I humbly retract my snark and
agree that it's better to exploit scandir()'s inclusion of stat()
details without additional calls.

-tkc



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