[Python-ideas] An async facade?

Guido van Rossum guido at python.org
Sat Dec 22 02:16:12 CET 2012


On Fri, Dec 21, 2012 at 5:13 PM, Jasper St. Pierre
<jstpierre at mecheye.net> wrote:
>
>
> On Fri, Dec 21, 2012 at 7:50 PM, Guido van Rossum <guido at python.org> wrote:
>>
>>
>> It's water under the bridge. We have PEP 380 in Python 3.3. I don't
>> want to change the language again in 3.4. Maybe after that we can
>> reconsider.
>
>
> One thing I'll say is that I think the coroutine decorator should convert
> something like:
>
>     @coroutine
>     def blah():
>         return "result"
>
> into the generator equivalent.

There's a tiny part of me that says that this might hide some bugs.
But mostly I agree and not doing it might make certain changes harder.
I did this in NDB too.

> You can do a syntax hack with:
>
>     @coroutine
>     def blah():
>         if 0: yield
>         return "result"
>
> but that feels bad. This sort of bug may seem unlikely, but a user may hit
> it if they're commenting out code,

Right.

> Maybe a generic @force_generator decorator might be useful...

That would be somebody else's PEP. :-)

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list