[Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator (original) (raw)
Jonas Wielicki j.wielicki at sotecware.net
Fri Jun 27 12:44:35 CEST 2014
- Previous message: [Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator
- Next message: [Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 27.06.2014 00:59, Ben Hoyt wrote:
Specifics of proposal ===================== [snip] Each
DirEntry
object has the following attributes and methods: [snip] Notes on caching ----------------The
DirEntry
objects are relatively dumb -- thename
attribute is obviously always cached, and theisX
andlstat
methods cache their values (immediately on Windows viaFindNextFile
, and on first use on Linux / OS X via astat
call) and never refetch from the system.
I find this behaviour a bit misleading: using methods and have them return cached results. How much (implementation and/or performance and/or memory) overhead would incur by using property-like access here? I think this would underline the static nature of the data.
This would break the semantics with respect to pathlib, but they’re only marginally equal anyways -- and as far as I understand it, pathlib won’t cache, so I think this has a fair point here.
regards, jwi
- Previous message: [Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator
- Next message: [Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]