On Sat, May 16, 2015 at 10:50 AM, Imran Geriskovan <
[email protected]> wrote:

> > So asynchronous object creation should be done by a factory coroutine,
> > and not by calling the standard constructor machinery.
>
> It may be done by a factory or a second async helper function
> method or by any other creative method. However, they all make the
> the code more bureaucratic. Elegance of single point __init__ is lost.
>

__init__ can't be a coroutine, but __new__ can (with the caveat that if
__new__ is a coroutine, __init__ will not be called at all):
https://github.com/tornadoweb/tornado/issues/1161#issuecomment-91367819

Personally I'd rather use an explicit factory function than __new__ magic
here, but it's possible to experiment with this style.

-Ben



>
> May be developers can consider allowing
>
> x = yield from X()


> as async style will be more wide spread with python 3.5+
> and resumable functions on C++.
>
> Regards,
> Imran
>

Reply via email to