Re: [Python-Dev] Remaining decisions on PEP 471 -- os.scandir()

2014-07-21 Thread Ben Hoyt
> We should mimic os.stat() and os.stat_result: os.stat_result symbol > exists in the os namespace, but the type constructor is not > documented. No need for extra protection like not adding the type in > the os module, or adding a "_" prefix to the name. Yeah, that works for me. > By the way, it

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-21 Thread Ben Hoyt
> I asked privately Guido van Rossum if I can be the BDFL-delegate for > the PEP 471 and he agreed. I accept the latest version of the PEP: > > http://legacy.python.org/dev/peps/pep-0471/ Thank you! > The PEP also explicitly mentions that os.walk() will be modified to > benefit of the new os.

Re: [Python-Dev] Remaining decisions on PEP 471 -- os.scandir()

2014-07-21 Thread Victor Stinner
2014-07-21 18:48 GMT+02:00 Ben Hoyt : >> By the way, DirEntry constructor is not documented in the PEP. Should >> we document it? It might be a way to "invalidate the cache": > > I would prefer not to, just to keep things simple. Similar to creating > os.stat_result() objects ... you can kind of do

[Python-Dev] PEP 471 "scandir" accepted

2014-07-21 Thread Victor Stinner
Hi, I asked privately Guido van Rossum if I can be the BDFL-delegate for the PEP 471 and he agreed. I accept the latest version of the PEP: http://legacy.python.org/dev/peps/pep-0471/ I consider that the PEP 471 "scandir" was discussed enough to collect all possible options (variations of th

Re: [Python-Dev] Remaining decisions on PEP 471 -- os.scandir()

2014-07-21 Thread Nick Coghlan
On 22 Jul 2014 02:46, "Steve Dower" wrote: > > Personally I'd make it a string subclass and put one-shot properties on it (i.e. call/cache stat() on first access where we don't already know the answer), which I think is close enough to where it's landed that I'm happy. (As far as bikeshedding goes

Re: [Python-Dev] Reviving restricted mode?

2014-07-21 Thread Victor Stinner
Hi, 2014-07-21 21:26 GMT+02:00 matsjoyce : > Sorry about being a bit late on this front (just 5 years...), but I've > extended tav's jail to module level, and added the niceties. It's goal is > similar to that of rexec, stopping IO, but not crashes. It is currently at > https://github.com/matsjoyc

Re: [Python-Dev] Reviving restricted mode?

2014-07-21 Thread matsjoyce
Sorry about being a bit late on this front (just 5 years...), but I've extended tav's jail to module level, and added the niceties. It's goal is similar to that of rexec, stopping IO, but not crashes. It is currently at https://github.com/matsjoyce/sandypython, and it has instructions as to its

Re: [Python-Dev] Remaining decisions on PEP 471 -- os.scandir()

2014-07-21 Thread Ben Hoyt
Thanks for an initial look into this, Victor. > IMO the current os.scandir() API does not fit importlib requirements. > importlib usually wants fresh data, whereas DirEntry cache cannot be > invalidated. It's probably possible to cache some os.stat() result in > importlib, but it looks like it req

Re: [Python-Dev] Remaining decisions on PEP 471 -- os.scandir()

2014-07-21 Thread Steve Dower
Victor Stinner wrote: > 2014-07-20 18:50 GMT+02:00 Antoine Pitrou : >> Have you tried modifying importlib's _bootstrap.py to use scandir() >> instead of listdir() + stat()? > > IMO the current os.scandir() API does not fit importlib requirements. > importlib usually wants fresh data, whereas DirEn

Re: [Python-Dev] Remaining decisions on PEP 471 -- os.scandir()

2014-07-21 Thread Victor Stinner
Hi, 2014-07-20 18:50 GMT+02:00 Antoine Pitrou : > Have you tried modifying importlib's _bootstrap.py to use scandir() instead > of listdir() + stat()? IMO the current os.scandir() API does not fit importlib requirements. importlib usually wants fresh data, whereas DirEntry cache cannot be invalid

Re: [Python-Dev] Remaining decisions on PEP 471 -- os.scandir()

2014-07-21 Thread Ben Hoyt
> Even though there is tangible performance improvement from scandir(), it > would be useful to find out if the API fits well. Got it -- I see where you're coming from now. I'll take a quick look (hopefully later this week). -Ben ___ Python-Dev mailing