Jonas Melian wrote:
> Is there any way more efficient for run a nested loop?
> 
> ------
> for a in list_a:
>     for b in list_b:
>         if a == b: break

efficient in running time? lines of code? What you have is pretty simple, what 
don't you like about it?

In Python 2.4 you could use a generator expression:
for (a for a in list_a for b in list_b if a==b):
  break

If you want to know which is faster you have to time them...
Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to