Author moloney
Recipients benhoyt, brett.cannon, moloney, python-dev, vstinner
Date 2016-08-15.22:11:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471299093.71.0.413470299844.issue27038@psf.upfronthosting.co.za>
In-reply-to
Content
The pathlib Path class is different enough from the DirEntry class that it doesn't really help my goal of allowing a function to work with either a DirEntry or a plain (str) path.

These functions are going to be working with DirEntry objects generated by scandir 99% of the time so that we can leverage the improved performance, but I want to allow users to pass in plain paths as well. If the stdlib doesn't allow me to create my own DirEntry object from a plain path I will probably end up creating some sort of FakeDirEntry class that mimics a DirEntry, and that seems a bit silly and not a great use of time and effort.

If the constructor currently "requires low-level data coming from
readdir() or FindFirstFile()" then why not a class method that just takes a path and calls stat on it? You could document the fact that it calls stat and that it doesn't have any of the performance benefits of using scandir. Consenting adults and all that...
History
Date User Action Args
2016-08-15 22:11:33moloneysetrecipients: + moloney, brett.cannon, vstinner, benhoyt, python-dev
2016-08-15 22:11:33moloneysetmessageid: <1471299093.71.0.413470299844.issue27038@psf.upfronthosting.co.za>
2016-08-15 22:11:33moloneylinkissue27038 messages
2016-08-15 22:11:33moloneycreate