Bill Mill <[EMAIL PROTECTED]> wrote:
   ...
> > > You are modifying the list as you iterate over it. Instead, iterate over
> > > a copy by using:
> > >
> > > for ip in ips[:]:
   ...
> Once you know it, it's neat, and I use it sometimes. However, it's a
> little too "magical" for my tastes; I'd rather be more explicit about
> what's going on.
Using ips[:] to make a copy on the fly is very idiomatic, but I've never
liked it, personally.  I see no reason to prefer it to the even shorter
and arguably less obscure ips*1, for example.  My preference is:

  for ip in list(ips):


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to