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

2014-07-15 Thread Victor Stinner
Le mardi 15 juillet 2014, Ben Hoyt benh...@gmail.com a écrit : Victor had one other question: What happens to name and full_name with followlinks=True? Do they contain the name in the directory (name of the symlink) or name of the linked file? I would say they should contain the name

Re: [Python-Dev] PEP 3121, 384 Refactoring Issues

2014-07-15 Thread Nick Coghlan
On 14 Jul 2014 11:41, Brett Cannon br...@python.org wrote: I agree for PEP 3121 which is the initialization/finalization work. The stable ABi is not necessary. So maybe we should re-examine the patches and accept the bits that clean up init/finalization and leave out any ABi-related changes.

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

2014-07-15 Thread Nick Coghlan
On 14 Jul 2014 22:50, Ben Hoyt benh...@gmail.com wrote: In light of that, I propose I update the PEP to basically follow Victor's model of is_X() and stat() following symlinks by default, and allowing you to specify follow_symlinks=False if you want something other than that. Victor had one

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

2014-07-15 Thread Ben Hoyt
Looks doable. Just make sure the cached entries reflect the 'follow_symlinks' setting -- so a symlink could end up with both an lstat cached entry and a stat cached entry. Yes, good point -- basically the functions will use the _stat cache if follow_symlinks=True, otherwise the _lstat cache.

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

2014-07-15 Thread Ben Hoyt
Sorry, I don't remember who but someone proposed to add the follow_symlinks parameter in scandir() directly. If the parameter is added to methods, there is no such issue. Yeah, I think having the DirEntry methods do different things depending on how scandir() was called is a really bad idea.

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

2014-07-15 Thread Ben Hoyt
I'd *keep DirEntry.lstat() method* regardless of existence of .stat(*, follow_symlinks=True) method (despite the slight violation of DRY principle) for readability. `dir_entry.lstat().st_mode` is more consice than `dir_entry.stat(follow_symlinks=False).st_mode` and the meaning of lstat is

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

2014-07-15 Thread Paul Moore
On 15 July 2014 13:19, Ben Hoyt benh...@gmail.com wrote: Hmmm, perhaps. You suggest .full_name implies it's the absolute path, which isn't true. I don't mind .path, but it kind of sounds like the Path object associated with this entry. I think full_name is fine -- it's not abs_name.

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

2014-07-15 Thread Ethan Furman
On 07/14/2014 11:25 PM, Victor Stinner wrote: Again: remove any garantee about the cache in the definitions of methods, instead copy the doc from os.path and os. Add a global remark saying that most methods don't need any syscall in general, except for symlinks (with follow_symlinks=True).

Re: [Python-Dev] Another case for frozendict

2014-07-15 Thread Russell E. Owen
In article CAPTjJmoZHLfT3G4eqV+=zcvbpf65fkcmah9h_8p162uha7f...@mail.gmail.com, Chris Angelico ros...@gmail.com wrote: On Mon, Jul 14, 2014 at 12:04 AM, Jason R. Coombs jar...@jaraco.com wrote: I can achieve what I need by constructing a set on the ‘items’ of the dict.

Re: [Python-Dev] Another case for frozendict

2014-07-15 Thread MRAB
On 2014-07-16 00:48, Russell E. Owen wrote: In article CAPTjJmoZHLfT3G4eqV+=zcvbpf65fkcmah9h_8p162uha7f...@mail.gmail.com, Chris Angelico ros...@gmail.com wrote: On Mon, Jul 14, 2014 at 12:04 AM, Jason R. Coombs jar...@jaraco.com wrote: I can achieve what I need by constructing a set on the

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

2014-07-15 Thread Cameron Simpson
I was going to stay out of this one... On 14Jul2014 10:25, Victor Stinner victor.stin...@gmail.com wrote: 2014-07-14 4:17 GMT+02:00 Nick Coghlan ncogh...@gmail.com: Or the ever popular symlink to . (or a directory higher in the tree). . and .. are explicitly ignored by os.listdir() an