何を繰り返しているかに応じて、複数の反復子クラスがあります。
>>> import re
>>> re.finditer("\d+", "1 ha 2 bah").__class__
<type 'callable-iterator'>
>>> iter([1, 2]).__class__
<type 'listiterator'>
>>> iter("hurm").__class__
<type 'iterator'>
2 つの質問:
- それらの間に意味のある違いはありますか?
- 最初のものはなぜ a と呼ばれるの
callable-iterator
ですか? 絶対に呼べません。