Erik Max Francis
max at alcyone.com
Fri Mar 14 04:41:46 CET 2003
Tim Peters wrote:
> > What is the purpose of arg in os.path.walk(path, visit, arg) ?
> It's just something passed to every visit() call. Passing None is
> fine. So
> is passing 42. You can do something useful with it by passing a
> object, and writing your visit() function to mutate that object. For
> example, you can arrange to have your visit() function accumulate a
> list of
> all .py files it found. Or you can use it to pass in control
> such as a list of file extensions you want to ignore.
This is, by the way, a pretty standard mechanism used in APIs that
support callbacks; you give a callback, and an object/pointer/reference
that will be sent to the callback by the caller, so that one can create
a context for the callback. (I know Tim knows this; this is for
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ If I had known, I would have become a watchmaker.
\__/ Albert Einstein
Bosskey.net / http://www.bosskey.net/
A personal guide to online multiplayer first person shooters.
More information about the Python-list