"Alexander Myodov" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello,
>  for k in a1:
>    pass
>  print "k: %s" % k
> where "k" lives long after the actual need in it was lost,

There are occasions, especially when one breaks out of the loop, when 
keeping k bound *is* useful.  If a1 generates big resources that you want 
the last one of freed, or if having k still bound just bothers you,

del k

> and even list comprehensions:
>  b1 = [l for l in a1]
>  print "l: %s" % l

This will go away in 3.0.  For now, del l if you wish.

Terry Jan Reedy



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

Reply via email to