How to get a directory list sorted by date?
cl at isbd.net
cl at isbd.net
Sun May 15 16:23:57 EDT 2016
Tim Chase <python.list at tim.thechases.com> wrote:
> On 2016-05-15 14:36, Grant Edwards wrote:
> > On 2016-05-15, Tim Chase <python.list at 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.
>
Thanks everyone for the ideas etc.
--
Chris Green
ยท
More information about the Python-list
mailing list