On Fri, Apr 26, 2019 at 11:12:51AM +1200, Greg Ewing wrote:
> Steven D'Aprano wrote:
> >I too often forget that reverse() returns an iterator,
> 
> That seems like a mistake. Shouldn't it return a view?

I don't know what it "should" or "shouldn't" it return, but it actually 
does return an iterator:

py> L = [1, 2, 3]
py> R = reversed(L)
py> hasattr(R, '__iter__') and iter(R) is R
True


-- 
Steven
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to