"Dave Angel" <da...@ieee.org> wrote


len() is very fast, so there's no need for a separate variable to keep track of the lengths of inpile1 and inpile2. So eliminate all refs to pile1c and pile2. In the while, just use
   while  len(inpile1) and len(inpile2):

Or even simpler:

while inpile1 and inpile2:

An empty list is false too.

pop(0) is slow, compared with pop(-1).

I didn't know that, but timing seems to suggest about 50% slower.
Interesting.

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to