Message150916
Thanks for that Charles-François - do you mind if I adapt that for walkdir?
The changes I would make are basically those that Antoine pointed out:
- rather than replacing the dirpath entry, instead yield a 4-tuple that appends the dirfd attribute at the end*
- if the dup(fd) fails, fall back to assuming top is a string or bytes path
*I'm still interested in opinions on this aspect. I see 5 main possibilities:
- (dirfd, subdirs, files) triple (problematic for the reasons Antoine pointed out)
- (dirpath, subdirs, files, dirfd) 4-tuple
- ((dirpath, dirfd), subdirs, files) nested tuple
- (dirpath, subdirs, files) tuple subclass with separate dirfd attribute
- (dirpath, subdirs, files) triple with dirpath as a str subclass with a separate fd attribute
I'm currently leaning towards the simple 4-tuple approach - it's simple, explicit and the walkdir pipeline operations can easily accept either underlying iterable by using indexing operations rather than tuple unpacking (a change I already planned to make so that the pipeline passed along the objects from the underlying iterable, anyway)
(I'll also need to create ctypes-based variants of all the relevant *at functions, since the stdlib wrappers won't be available in existing versions of Python) |
|
Date |
User |
Action |
Args |
2012-01-08 23:41:21 | ncoghlan | set | recipients:
+ ncoghlan, pitrou, tarek, neologix, rosslagerwall, hynek |
2012-01-08 23:41:21 | ncoghlan | set | messageid: <1326066081.89.0.0296311740486.issue13734@psf.upfronthosting.co.za> |
2012-01-08 23:40:21 | ncoghlan | link | issue13734 messages |
2012-01-08 23:40:21 | ncoghlan | create | |
|