Limitation of os.walk

kj no.email at please.post
Wed May 12 15:04:47 EDT 2010


In <mailman.82.1273630064.32709.python-list at python.org> Terry Reedy <tjreedy at udel.edu> writes:

>On 5/11/2010 3:49 PM, kj wrote:
>> PS: I never understood why os.walk does not support hooks for key
>> events during such a tree traversal.

>Either 1) it is intentionally simple, with the expectation that people 
>would write there own code for more complicated uses or 2) no one has 
>submitted a 'full-featured' version or 3) both.

I hope it's not (1): I want the language I use to include more
"batteries" not fewer.

<petpeeve>It seems that a similar "simplicity argument" was invoked
to strip the cmp option from sort in Python 3.  Grrrr.  Simplicity
is great, but when the drive for it starts causing useful functionality
to be thrown out, then it is going too far.  Yes, I know that it
is possible to do everything that sort's cmp option does through
clever tricks with key, but grokking and coding this maneuver
requires a *lot* more Python-fu than cmp did, which makes this
functionality a lot less accessible to beginners that the intrinsic
complexity of the problem warrants.  And for what?  To get rid of
an *option* that could be easily disregarded by anyone who found
it too "complex"? It makes no sense to me.</petpeeve>



More information about the Python-list mailing list