[Python-ideas] Suggested MapView object (Re: __len__() for map())
rosuav at gmail.com
Thu Dec 13 01:16:34 EST 2018
On Thu, Dec 13, 2018 at 4:54 PM Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Chris Angelico wrote:
> > On Thu, Dec 13, 2018 at 3:07 PM Chris Barker - NOAA Federal via
> > Python-ideas <python-ideas at python.org> wrote:
> >>>>> obj is iter(obj)
> >>Is that a hard and fast rule?
> > Yes, it is.
> > https://docs.python.org/3/library/stdtypes.html#iterator-types
> The docs aren't very clear on this point. They claim this is necessary
> so that the iterator can be used in a for-loop, but that's obviously
> not strictly true, since a proxy object could also be used.
Return the iterator object itself.
I do believe "the iterator object itself" means that
"iterator.__iter__() is iterator" should always be true. But maybe
there's some other way to return "the object itself" other than
actually returning "the object itself"?
More information about the Python-ideas