14 Oct
2012
14 Oct
'12
8:04 a.m.
On Sun, Oct 14, 2012 at 1:03 PM, Antoine Pitrou
On Sun, 14 Oct 2012 21:48:59 +1100 Steven D'Aprano
wrote:> -1 on iteration over the children. Instead, use: for child in p.walk(): ...
which has the huge benefit that the walk method can take arguments as needed, such as the args os.walk takes:
topdown=True, onerror=None, followlinks=False
Judging by its name and signature, walk() would be a recursive operation, while iterating on a path isn't (it only gets you the children).
Steven realized what currently happens and was suggesting doing it differently. Personally I really dislike the idea that [i for i in p][0] != p[0] It makes no sense to have this huge surprise.