On 2015-04-23 3:03 AM, Greg Ewing wrote:
Yury Selivanov wrote:
- If it's an object with __await__, return iter(object.__await__())

Is the iter() really needed? Couldn't the contract of
__await__ be that it always returns an iterator?


I wrote it the wrong way. iter() isn't needed, you're right.
This is a quote from the ref implementation:

   if (!PyIter_Check(await_obj)) {
        PyErr_Format(PyExc_TypeError,
                     "__await__ must return an iterator, %.100s",
                     Py_TYPE(await_obj)->tp_name);


Yury
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to