Hi Imran,

On 2016-01-31 6:51 AM, Imran Geriskovan wrote:
Currently class instances can not
directly be created asyncronously.

Yes, there are other means for async
creation. (As we have discussed before,
factories, __new__ is a coroutine, etc)

However, having all creation logic, under
the class definition and similar to
__init__ is more elegant.

Regards,
Imran

I don't think it's possible to implement this (even if
we would like to).

See, in "await something()", "await" receives the result
of "something()".  So even if "something" is a class with
an "__ainit__", it will be already instantiated (with
__init__ and __new__).

Right now, "await obj" checks for an __await__ method.
Adding __ainit__ in the mix, with unclear semantics,
would only complicate things and make a negative
performance impact.

Yury

Reply via email to