Re: [Tutor] Using a list comp in place of a for loop

2009-10-04 Thread Rich Lovely
2009/10/3 afith13 : > Hi tutors, > > I've got a loop and a comprehension that do the same thing (as far as I can > tell): > > for i in range(N): >  someList.append.newObject(i) > > ...and... > > [someList.append.newObject(i) for i in range(N)] > > I'm tempted to write this as a list comp because i

[Tutor] Using a list comp in place of a for loop

2009-10-04 Thread afith13
Hi tutors, I've got a loop and a comprehension that do the same thing (as far as I can tell): for i in range(N): someList.append.newObject(i) ...and... [someList.append.newObject(i) for i in range(N)] I'm tempted to write this as a list comp because it's a big list and I've read that list