On Thu, Dec 13, 2018 at 4:54 PM Greg Ewing <greg.ew...@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@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. >
iterator.__iter__() 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"? ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/