recursing glob
Don Dwiggins
dwig at advancedmp.net
Fri Feb 16 13:46:31 EST 2001
Grant Griffin writes:
> Fredrik Lundh wrote:
>>
>> Grant Griffin wrote:
>> > Somehow I never am happy with stuff I do with os.walk--is it
>> > just me?
>>
>> no.
> In retrospect, I think os.walk would be a lot friendlier if it passed
> two arguments to its function instead of one. (When I first began with
> Python, I didn't realize that that "one" argument could be a list or a
> tuple.)
Maybe what's needed here is an implementation of the Visitor pattern from
the Gamma et al. "Design Patterns" book. I did a file system Visitor in
Visual Basic (pardon my French!) as a learning exercise a while back, and
found it easy to implement and use once I grokked it (should be much nicer
in Python, though). It's worth considering (not necessarily choosing)
Visitor whenever you need to "iterate" over a complex structure.
--
Don Dwiggins "Solvitur Ambulando"
Advanced MP Technology
dwig at advancedmp.net
More information about the Python-list
mailing list