[Tutor] [whitelist] Re: os.path.walk
nimrodx at slingshot.co.nz
Wed Aug 23 13:52:08 CEST 2006
I will have a go at both of the methods.
Alan Gauld wrote:
>> Yes, that is the right way to do it and it will work fine. Something
>> class Walker(object):
>> def walk(self, base):
>> os.path.walk(base, self.callback, None)
>> What happens is, when Python looks up self.callback it converts the
>> method to a "bound method".
> Aargh! I should have remembered that. No need for lambdas here.
>> But, if you are using a recent version of Python (2.3 or greater)
>> you should look at os.walk(), it is easier to use than
> But I did suggest that too :-)
> Alan G.
> Tutor maillist - Tutor at python.org
More information about the Tutor