On Sun, Aug 21, 2016 at 1:27 AM Chris Angelico <ros...@gmail.com> wrote:
> Hmm. It would somehow need to be recognized as "not iterable". I'm not > sure how this detection is done; is it based on the presence/absence > of __iter__, or is it by calling that method and seeing what comes > back? If the latter, then sure, an __iter__ that raises would cover > that. > The detection of not hashable via __hash__ set to None was necessary, but not desirable. Better to have never defined the method/attribute in the first place. Since __iter__ isn't present on ``object``, we're free to use the better technique of not defining __iter__ rather than defining it as None, NotImplemented, etc. This is superior, because we don't want __iter__ to show up in a dir(), help(), or other tools.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/