On Fri, 30 Jun 2017 09:17 am, Stefan Ram wrote:

>>>> b = a.__iter__()

Don't do that.

Dunder ("Double UNDERscore") methods like __iter__ should only be called by the
Python interpreter, not by the programmer. The right way to create an iterator
is to call the built-in function iter:

b = iter(a)


The iter() function may call a.__iter__ (technically, it calls type(a).__iter__
instead) but it may also do other things, which you miss out on if you call
__iter__ directly.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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

Reply via email to