[snip] >> 2. side effect of (maybe) leaking the iterator variable "value" into >> the code following the loop (if the iterator is not empty). > > So? it is sometime useful.
Except that you can't guarantee that it will be set since the for loop will not execute if the iterable is empty. >> >> I can take care of 2 by explicitly deleting the variable at the end: >> >> del value >> >> but I'd probably forget to do that sometimes. > > So? If having 'value' bound breaks your subsequent code, I consider it > buggy. Quite so. I just like to eliminate the possibility up front. If 'value' is never bound, the the bug will show up sooner. -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list