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 palaviv
Recipients loewis, palaviv
Date 2016-04-26.13:45:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461678306.82.0.694875654943.issue26860@psf.upfronthosting.co.za>
In-reply-to
Content
I am suggesting that os.walk and os.fwalk will yield a namedtuple instead of the regular tuple they currently yield.
The use case for this change can be seen in the next example:

def walk_wrapper(walk_it):
    for dir_entry in walk_it:
        if dir_entry[0] == "aaa":
           yield dir_entry

Because walk_it can be either os.walk or os.fwalk I need to access dir_entry via index.

My change will allow me to change this function to:

def walk_wrapper(walk_it):
    for dir_entry in walk_it:
        if dir_entry.dirpath == "aaa":
           yield dir_entry

Witch is more clear and readable.
History
Date User Action Args
2016-04-26 13:45:06palavivsetrecipients: + palaviv, loewis
2016-04-26 13:45:06palavivsetmessageid: <1461678306.82.0.694875654943.issue26860@psf.upfronthosting.co.za>
2016-04-26 13:45:06palavivlinkissue26860 messages
2016-04-26 13:45:06palavivcreate