On Thu, Apr 23, 2015 at 5:32 PM, Yury Selivanov <yselivanov...@gmail.com> wrote:
> Hi Wolfgang, > > On 2015-04-23 8:27 AM, Wolfgang Langner wrote: > >> On Thu, Apr 23, 2015 at 12:35 PM, Paul Sokolovsky <pmis...@gmail.com> >> wrote: >> >> Hello, >>> >>> On Thu, 23 Apr 2015 12:18:51 +0300 >>> Andrew Svetlov <andrew.svet...@gmail.com> wrote: >>> >>> [] >>> >>> 3. >>>>> async with and async for >>>>> Bead idea, we clutter the language even more and it is one more >>>>> thing every newbie could do wrong. >>>>> for x in y: >>>>> result = await f() >>>>> is enough, every 'async' framework lived without it over years. >>>>> >>>> async for i in iterable: >>>> pass >>>> >>>> is not equal for >>>> >>>> for fut in iterable: >>>> i = yield from fut >>>> >>> But people who used Twisted all their life don't know that! They just >>> know that "async for" is not needed and bad. >>> >>> >>> I don't think it is bad nor not needed, but the syntax is not beautiful >> and >> for the 90% not doing async stuff irritating and one more thing to learn >> and do right/wrong. >> > There is no way to do things wrong in PEP 492. An object > either has __aiter__ or it will be rejected by async for. > An object either has __aenter__ or it will be rejected by > async with. > Don't mean it can be done wrong on execution or syntax level. I mean for a beginner it is not as easy an more and some will try async in some places, yes they will get an error. But there is a new possibility to get such errors if async is there for with and for statements. And the next beginner will then implement __aiter__ instead of __iter__ because he/she don't get it. On the other side I like "await" and __await__ implementation. Symmetric good easy to explain, same with "int" and "__int__" and all others. > > transaction = yield from connection.transaction() > try: > ... > except: > yield from transaction.rollback() > else: > yield from transaction.commit() > > is certainly more irritating than > > async with connection.transcation(): > ... > > Sorry till now I use async stuff and database access and do it in an extra thread in sync mode. No performance problems and can use all good maintained database libraries. Also twisteds RDBMS (adbapi) is enough here. First I thought it is not enough or to slow but this was not the case. https://twistedmatrix.com/documents/current/core/howto/rdbms.html Here I am on line with Mike Bayer: http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/
_______________________________________________ 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