This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients hynek, ncoghlan, neologix, pitrou, rosslagerwall, tarek
Date 2012-01-08.23:40:21
SpamBayes Score 5.8745175e-11
Marked as misclassified No
Message-id <1326066081.89.0.0296311740486.issue13734@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2012-01-08 23:41:21ncoghlansetrecipients: + ncoghlan, pitrou, tarek, neologix, rosslagerwall, hynek
2012-01-08 23:41:21ncoghlansetmessageid: <1326066081.89.0.0296311740486.issue13734@psf.upfronthosting.co.za>
2012-01-08 23:40:21ncoghlanlinkissue13734 messages
2012-01-08 23:40:21ncoghlancreate