[Python-ideas] PEP: Extended stat_result (First Draft)
Giampaolo Rodola'
g.rodola at gmail.com
Mon May 6 21:46:00 CEST 2013
2013/5/6 Pieter Nagel <pieter at nagel.co.za>:
> But the primary motivation is not to avoid an import and "ugly" method
> names; the primary motivation is to make it easier to switch from
> writing naive code that stat()s a file many times to performant code
> that does stat() only once. The rest is just a happy side effect.
I don't understand what your proposal has to do with calling os.stat()
once or twice (you can already call it once and use stat.S_IS*
functions).
> And the *ulterior* motivation is to reduce the need for automagic stat()
> caching in PEP 428.
Can you elaborate more (and possibly also update the PEP including
this motivation)?
>> -1 about these too.
>> os.path provides only isfile(), isdir() and islink() because those are
>> the most common and portable file types, and that's fine.
>> Anything else is too specific (also *platform* specific) and does not
>> deserve a new utility function in os.path.
>
> The extent to which my additions to stat_result are "mirrored back" to
> os.path is one of the least certain parts of my proposal.
Fair enough.
> And when PEP 428 is accepted, there'll be *three* places where these
> methods could live, so I'll have to take that into account.
Another reason to leave os.path.* alone. =)
--- Giampaolo
https://code.google.com/p/pyftpdlib/
https://code.google.com/p/psutil/
https://code.google.com/p/pysendfile/
More information about the Python-ideas
mailing list