os.path.walk arg

Afanasiy abelikov72 at hotmail.com
Thu Mar 13 11:25:45 EST 2003


What is the purpose of arg in os.path.walk(path, visit, arg) ?

The documentation states : 

Calls the function visit with arguments (arg, dirname, names) for each
directory in the directory tree rooted at path (including path itself, if
it is a directory). The argument dirname specifies the visited directory,
the argument names lists the files in the directory (gotten from
os.listdir(dirname)). The visit function may modify names to influence the
set of directories visited below dirname, e.g., to avoid visiting certain
parts of the tree. (The object referred to by names must be modified in
place, using del or slice assignment.) 

I assume I can pass arguments to my visitor function, so I specify None.
Upon doing so I wonder why that would not be a default and am reminded
of the magic of specifying so many NULL's in Win32 API calls from C.




More information about the Python-list mailing list