os.path.walk arg
Steven Taschuk
staschuk at telusplanet.net
Fri Mar 14 02:42:02 EST 2003
Quoth Erik Max Francis:
[...]
> 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
> Afanasiy's benefit.)
It is fairly common, and makes sense in C; but it seems a little
odd in Python. If os.path.walk had no such provision, but I had a
visitor function that needed a context object, then I'd just do
walk(path, lambda d,n: visit(context, d, n))
or the like, and wouldn't think twice about it.
--
Steven Taschuk staschuk at telusplanet.net
"Telekinesis would be worth patenting." -- James Gleick
More information about the Python-list
mailing list