[Python-ideas] What are the strong use cases for str.rindex()?
Steven D'Aprano
steve at pearwood.info
Fri Apr 26 00:34:29 EDT 2019
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
More information about the Python-ideas
mailing list