os.path.walk arg
Michael Hudson
mwh at python.net
Fri Mar 14 05:42:26 EST 2003
Steven Taschuk <staschuk at telusplanet.net> writes:
> 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.
You noticed :-)
> 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.
Or a bound method.
I suspect os.path.walk has made a net postive contribution to the
amount of confusion in the universe.
Cheers,
M.
--
The Oxford Bottled Beer Database heartily disapproves of the
excessive consumption of alcohol. No, really.
-- http://www.bottledbeer.co.uk/beergames.html
(now sadly gone to the big 404 in the sky)
More information about the Python-list
mailing list