Erik Max Francis
max at alcyone.com
Sat Mar 15 07:49:29 CET 2003
Steven Taschuk wrote:
> 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.
True, but still, it's nice having the functionality there.
I agree that in a true Pythonic sense, having a revamped os.path.walk
API which returns an iteratable object (probably a generator) makes a
lot more sense, as someone else pointed out; it seems a lot more elegant
for file in walk(dir):
walk(dir, lambda f: ...)
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ To know oneself, one should assert oneself.
\__/ Albert Camus
7 Sisters Productions / http://www.7sisters.com/
Web design for the future.
More information about the Python-list