Mark Dickinson <[email protected]> added the comment:

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.  :-)

----------

_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6921>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to