On Sat, May 16, 2015 at 11:50 AM, Imran Geriskovan <[email protected]> wrote: > 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.
The "single point" you mention is an illusion. __new__ is always invoked as part of object construction. If your class does not implement it, the inherited __new__ is called to build the actual instance. Always. > x = yield from X() > > as async style will be more wide spread with python 3.5+ > and resumable functions on C++. I agree the idea of an async constructor is intriguing, but I don't think implementing an async factory is so bad. If you'd like to promote your idea I think you should consider how `yield from X()` will interact with __new__ and __init__, and whether new special methods would be required besides __new__ and __init__. Best, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg
