[Tutor] [whitelist] Re: os.path.walk
nimrodx
nimrodx at slingshot.co.nz
Wed Aug 23 13:52:08 CEST 2006
Thanks guys,
I will have a go at both of the methods.
Matt
Alan Gauld wrote:
>> Yes, that is the right way to do it and it will work fine. Something
>> like
>>
>> 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.
> Apologies...
>
>
>> 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
>> os.path.walk().
>>
>
> But I did suggest that too :-)
>
> Alan G.
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
More information about the Tutor
mailing list