Re: synching with os.walk()

2006-11-24 Thread 120psi
> os.walk() is a nice generator for performing actions on all files in a > directory and subdirectories. However, how can one use os.walk() for walking > through two hierarchies at once? I want to synchronise two directories (just > backup for now), but cannot see how I can traverse a second one. I

Re: Local variables persist in functions?

2006-11-24 Thread 120psi
John Machin wrote: > [EMAIL PROTECTED] wrote: > > I'm a bit baffled. Here is a bit of fairly straightforward code: > > > > def _chunkify( l, chunkSize, _curList = list() ): > > Quite apart from the default argument problem, which Duncan has > addressed, you have some problems with style and varia

Re: Local variables persist in functions?

2006-11-24 Thread 120psi
> http://www.python.org/doc/faq/general.html#why-are-default-values-shared-between-objects Thanks for the link. I think I'll stick to None as the default value, as that's a good way to keep the usability and make my code work ;) -- http://mail.python.org/mailman/listinfo/python-list

Local variables persist in functions?

2006-11-24 Thread 120psi
I'm a bit baffled. Here is a bit of fairly straightforward code: def _chunkify( l, chunkSize, _curList = list() ): print _curList # yay for printf debugging if len( l ) <= chunkSize: _curList.append( l ) else: newChunk = l[:chunkSize] _curList.append( newChun