the visitor framework handles walking details automatically the collectorfor instancesimply appends to list as search visitor detects matched files and allows the default list of text filename extensions in the search visitor to be overridden per instance--it' roughly like combination of find and grep on unixfrom visitor_collect import collectvisitor collectvisitor('mimetypes'testexts=[py'pyw']trace= run( ' :\temp\pp \examples'for name in matchesprint(namepy and pyw files with 'mimetypesc:\temp\pp \examples\pp \internet\email\mailtools\mailparser py :\temp\pp \examples\pp \internet\email\mailtools\mailsender py :\temp\pp \examples\pp \internet\ftp\mirror\downloadflat py :\temp\pp \examples\pp \internet\ftp\mirror\downloadflat_modular py :\temp\pp \examples\pp \internet\ftp\mirror\ftptools py :\temp\pp \examples\pp \internet\ftp\mirror\uploadflat py :\temp\pp \examples\pp \system\media\playfile py :\pp \toolsvisitor_collect py mimetypes :\temp\pp \examples as script the core logic of the biggest-file visitor is similarly straightforwardand harkens back to startclass bigpy(filevisitor)def __init__(selftrace= )filevisitor __init__(selfcontext=[]trace=tracedef visitfile(selffilepath)filevisitor visitfile(selffilepathif filepath endswith(py')self context append((os path getsize(filepath)filepath)and the bytecode-removal visitor brings us back full circleshowing an additional alternative to those we met earlier in this it' essentially the same codebut it runs os remove on pycfile visits in the endwhile the visitor classes are really just simple wrappers for os walkthey further automate walking chores and provide general framework and alternative classbased structure which may seem more natural to some than simple unstructured loops they're also representative of how python' oop support maps well to real-world structures like file systems although os walk works well for one-off scriptsthe better extensibilityreduced redundancyand greater encapsulation possible with oop can be major asset in real work as our needs change and evolve over time complete system programs