#NEWLINE# def walk( self , file = None , pre = None , post = None ) : #NEWLINE# #INDENT# 'Simple walking method\n\n\t\tFor directories:\n\t\t\tpre(path) is called before starting to process each directory\n\t\t\tsubmember.walk(file,pre,post) is called on each sub-member\n\t\t\tpost(path) is called after processing all sub-members of the directory\n\t\tFor files:\n\t\t\tfile( path ) is called for each file in each directory\n\t\t' #NEWLINE# if ( ( not file ) and ( not pre ) and ( not post ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if self . isFile ( ) : #NEWLINE# #INDENT# if file : #NEWLINE# #INDENT# file ( self ) #NEWLINE# #UNINDENT# #UNINDENT# if self . isDir ( ) : #NEWLINE# #INDENT# if pre : #NEWLINE# #INDENT# pre ( self ) #NEWLINE# #UNINDENT# children = self . list ( ) #NEWLINE# for child in children : #NEWLINE# #INDENT# child . walk ( file , pre , post ) #NEWLINE# #UNINDENT# if post : #NEWLINE# #INDENT# post ( self )