Tim Golden wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Dave Angel wrote:

def find(root):
   for pdf in os.walk(root, topdown=False):
           for file in pdf[2]:
               yield os.path.join(pdf[0],file)




At the risk of nitpicking, I think that a modicum of
tuple-unpacking would aid readability here:

<code>

for dirpath, dirnames, filenames in os.walk (root, topdown=False):
 for filename in filenames:
   yield os.path.join (dirpath, filename)

</code>

TJG

</div>

Absolutely, readability is paramount. But in my defense, I was trying to make the minimal change necessary to the code that had been already posted, just to turn it into a generator. I didn't even notice why the pdf name was used till you pointed out the expansion.

DaveA
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to