Message92707
Ah, I see the problem now: you're expecting that after
for p, elt in enumerate(mylist):
<do_stuff>
p will be equal to len(mylist)-1. That's true if mylist is nonempty
(because on the last round of the for loop, p gets the value len(mylist)-
1), but if mylist is empty then no assignment to p or to elt is ever made.
That's just the way that Python for loops work, I'm afraid. :-) |
|
Date |
User |
Action |
Args |
2009-09-16 18:22:39 | mark.dickinson | set | recipients:
+ mark.dickinson, mrdiskodave |
2009-09-16 18:22:39 | mark.dickinson | set | messageid: <1253125359.15.0.202381672279.issue6921@psf.upfronthosting.co.za> |
2009-09-16 18:22:38 | mark.dickinson | link | issue6921 messages |
2009-09-16 18:22:37 | mark.dickinson | create | |
|