blog.fuktommy.com

for b in a: for c in b: for d in c: do_something(d) の入れ子ループを避けるためにイテレータを使ってみる。 bb = wrapper(a) cc...

for b in a:
 for c in b:
  for d in c:
   do_something(d)

の入れ子ループを避けるためにイテレータを使ってみる。

bb = wrapper(a)
cc = wrapper(bb)
dd = wrapper(cc)
for d in dd:
 do_something(d)

あんまり意味ないかもなあ…
あとPythonじゃなくてPHPなので、ジェネレータが使えないんだよな…
Copyright© 1998-2014 Fuktommy. All Rights Reserved.
webmaster@fuktommy.com (Legal Notices)