The proposal I was replying to was that: - There is no .refresh() - ensure_lstat=False means no OS has populated attributes - ensure_lstat=True means ever OS has populated attributes
Even if we add a .refresh(), the latter two items mean that you can't avoid doing extra work (either too much on windows, or too much on linux), if you want only a subset of the files' lstat info. -- Devin P.S. your mail client's quoting breaks my mail client (gmail)'s quoting. On Mon, Jun 30, 2014 at 7:04 PM, Glenn Linderman <v+pyt...@g.nevcal.com> wrote: > On 6/30/2014 4:25 PM, Devin Jeanpierre wrote: > > On Mon, Jun 30, 2014 at 3:07 PM, Tim Delaney > <timothy.c.dela...@gmail.com> wrote: > > On 1 July 2014 03:05, Ben Hoyt <benh...@gmail.com> wrote: > > So, here's my alternative proposal: add an "ensure_lstat" flag to > scandir() itself, and don't have *any* methods on DirEntry, only > attributes. > > ... > > Most importantly, *regardless of platform*, the cached stat result (if > not None) would reflect the state of the entry at the time the > directory was scanned, rather than at some arbitrary later point in > time when lstat() was first called on the DirEntry object. > > I'm torn between whether I'd prefer the stat fields to be populated on > Windows if ensure_lstat=False or not. There are good arguments each way, but > overall I'm inclining towards having it consistent with POSIX - don't > populate them unless ensure_lstat=True. > > +0 for stat fields to be None on all platforms unless ensure_lstat=True. > > This won't work well if lstat info is only needed for some entries. Is > that a common use-case? It was mentioned earlier in the thread. > > > If it is, use ensure_lstat=False, and use the proposed (by me) .refresh() > API to update the data for those that need it. > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/jeanpierreda%40gmail.com > _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com