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 comps are faster than for loops in general. I'm hesitating because 
I'm not sure if building a big list of "None" objects and then throwing it away 
has any drawbacks.

Thanks in advance,
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to