Re: [Tutor] List methods/comps Best Practices

2006-04-03 Thread stv
> So don't write: > [adds.add_changes('foo', path) for path in filelist] > but: > for path in filelist: adds.add_changes('foo', path) Excellent point; new toy, got carrid away :) I feel silly on that one. And now that I've made the return list.extend(foo) mistake, I'll surely neve- ... er, wa

Re: [Tutor] List methods/comps Best Practices

2006-04-03 Thread Kent Johnson
stv wrote: > # return all changes, deletes first > return dels.extend(adds) > > Since extend returns None, I ran into a lot of not-iterable errors > when calling this code. So I fixed this with > > dels.extend(adds) > return dels > > And all is good, although it took way more head scratc

Re: [Tutor] List methods/comps Best Practices

2006-04-03 Thread Karl Pflästerer
On 3 Apr 2006, [EMAIL PROTECTED] wrote: > I had several list comprehensions that I was mucking with; these lists > are working on a simple subclass of the built-in list object. They > looked liked this: > > filelist = getFilesToAdd() > filelist2 = getFilesToDel() > > adds = MyList('foo') >