Re: [Async-sig] PEP: asynchronous generators

2016-07-29 Thread Andrew Svetlov
ies - this > is now a side discussion, and not about this pep): everything in CPython > is async, and if you don't want async, you don't need to know about, you > run a single async task and don't need to know more... > > Can we get there? > That would be cool... > > - Yarko > ___ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ -- Thanks, Andrew Svetlov ___ Async-sig mailing list Async-sig@python.org https://mail.python.org/mailman/listinfo/async-sig Code of Conduct: https://www.python.org/psf/codeofconduct/

Re: [Async-sig] PEP: asynchronous generators

2016-07-29 Thread Andrew Svetlov
Ok, if the implementation gets `asend()` etc. "for free" I support it. On Fri, Jul 29, 2016 at 9:14 PM Yury Selivanov wrote: > > > On Jul 29, 2016, at 3:06 PM, Andrew Svetlov > wrote: > > > > I'm personally think that `a` prefix is pretty fine and under

Re: [Async-sig] PEP: asynchronous generators

2016-07-30 Thread Andrew Svetlov
) > ... > > In this case user would be able to use async generators without worring he > will get warning. > > ___ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/

Re: [Async-sig] PEP: asynchronous generators

2016-07-30 Thread Andrew Svetlov
7;t do anything in case user will write: > > while True: >pass > > -- Thanks, Andrew Svetlov ___ Async-sig mailing list Async-sig@python.org https://mail.python.org/mailman/listinfo/async-sig Code of Conduct: https://www.python.org/psf/codeofconduct/

Re: [Async-sig] PEP: asynchronous generators

2016-07-30 Thread Andrew Svetlov
I just don't see any other way to use some async generator > (that needs some time to be closed) without getting warning. > > In case malformed generator is unwanted behaviour may be it'll be ok to > show warning in debug mode if some close task isn't finished after som

[Async-sig] Warts both in asyncio way and greenlet-based approach

2016-08-02 Thread Andrew Svetlov
tings about gevent as my private opinion, and it is. But from my perspective asyncio based solutions have much more predictable behavior and much more friendly to debug-and-fix problems. -- Thanks, Andrew Svetlov ___ Async-sig mailing list Async-sig@python

Re: [Async-sig] Warts both in asyncio way and greenlet-based approach

2016-08-04 Thread Andrew Svetlov
eld wrote: > > On 2 Aug 2016, at 19:39, Andrew Svetlov wrote: > > Long story short: in async world every IO library should use asyncio. > Unfortunately for the most popular libraries (requests, django, flask, > sqlalchemy etc.) it's impossible to rewrite the code keeping b

Re: [Async-sig] Some thoughts on asynchronous API design in a post-async/await world

2016-11-07 Thread Andrew Svetlov
dd “current_event_loop()” coroutine. > > This will enforce (1) and (2), making asyncio library devs/users to focus > more on coroutines and async/await. > > Am I understanding this all correctly? > > Yury > ___ > A

Re: [Async-sig] Some thoughts on asynchronous API design in a post-async/await world

2016-11-07 Thread Andrew Svetlov
-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ > > > > > -- > --Guido van Rossum (python.org/~guido) > ___ > Async-sig mailing list > Async-

Re: [Async-sig] PyCon US 2017 open space on Saturday sometime after lunch

2017-05-18 Thread Andrew Svetlov
list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ > -- Thanks, Andrew Svetlov ___ Async-sig mailing list Async-sig@python.org https://mail.python.org/mailm

Re: [Async-sig] async/sync library reusage

2017-06-12 Thread Andrew Svetlov
>>>> >> were more user-error than anything else. However, I feel comfortable >>>> saying >>>> >> that libraries spawning their own Python threads is definitely >>>> subtle and >>>> >> hard to get right, at the very least. &

Re: [Async-sig] async/sync library reusage

2017-06-12 Thread Andrew Svetlov
van Rossum wrote: > Yes, but not co-existing, I hope! > > On Mon, Jun 12, 2017 at 9:25 AM, Andrew Svetlov > wrote: > >> Unit tests at least. Running every test in own loop is crucial fro tests >> isolation. >> >> On Mon, Jun 12, 2017 at 7:04 PM Guido van Ros

Re: [Async-sig] async/sync library reusage

2017-06-12 Thread Andrew Svetlov
e default. There are some rare use cases for > multiple loops running but before the mentioned commit it was up to the app > to ensure to switch the default loop when running a loop. The commit took > the ability to screw up there out of the user's hand. > > On Mon, Jun 12, 2017

Re: [Async-sig] "read-write" synchronization

2017-06-25 Thread Andrew Svetlov
__ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ > -- Thanks, Andrew Svetlov ___ Async-si

Re: [Async-sig] async generator confusion or bug?

2017-06-26 Thread Andrew Svetlov
Where are those None's coming from in the end? > > Where did "user-0" and "user-1" data go? > > > Interesting. If I replace "gather" with three consecutive awaits of > "asend", everything works as expected. So there's some

Re: [Async-sig] question re: asyncio.Condition lock acquisition order

2017-06-27 Thread Andrew Svetlov
awakened > next, or are there no guarantees about the order? > > Thanks a lot, > --Chris > ___ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > C

Re: [Async-sig] async documentation methods

2017-06-30 Thread Andrew Svetlov
; docs, please tell. > > Likewise, should there be marks on iterators? async generators? things > that ought to be used as context managers? > > Cheers, > d. > ___ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig &

Re: [Async-sig] async documentation methods

2017-07-04 Thread Andrew Svetlov
nd it is a bit >>>>> opinionated (in particular it calls async functions async functions >>>>> instead of coroutines). >>>>> >>>>> For the original text, I'd probably write something like:: >>>>> >>>>>

Re: [Async-sig] async documentation methods

2017-07-04 Thread Andrew Svetlov
asyncio-only code :) > > I haven't noticed that earlier. > > On 4 July 2017 at 16:40, Andrew Svetlov wrote: > > Did you look on > > > https://github.com/python/cpython/blob/master/Lib/asyncio/test_utils.py#L265 > > ? > > > > On Tue, Jul 4, 2017 at 1:04 P

Re: [Async-sig] async documentation methods

2017-07-06 Thread Andrew Svetlov
lman/listinfo/async-sig >> Code of Conduct: https://www.python.org/psf/codeofconduct/ >> > ___ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ > -- Thanks, Andrew Svetlov ___ Async-sig mailing list Async-sig@python.org https://mail.python.org/mailman/listinfo/async-sig Code of Conduct: https://www.python.org/psf/codeofconduct/

Re: [Async-sig] using asyncio in synchronous applications

2017-07-11 Thread Andrew Svetlov
in different threads? Is either approach much more > >> >> efficient than the other? > >> >> > >> >> Thanks, > >> >> --Chris > >> >> > >> >> [1] http://docs.gunicorn.org/en/latest/design.html#sync-workers > >> >> ___ > >> >> Async-sig mailing list > >> >> Async-sig@python.org > >> >> https://mail.python.org/mailman/listinfo/async-sig > >> >> Code of Conduct: https://www.python.org/psf/codeofconduct/ > >> > > >> > > >> > > >> > > >> > -- > >> > --Guido van Rossum (python.org/~guido) > > > > > > > > > > -- > > --Guido van Rossum (python.org/~guido) > ___ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ > -- Thanks, Andrew Svetlov ___ Async-sig mailing list Async-sig@python.org https://mail.python.org/mailman/listinfo/async-sig Code of Conduct: https://www.python.org/psf/codeofconduct/

Re: [Async-sig] using asyncio in synchronous applications

2017-07-11 Thread Andrew Svetlov
p but `asyncio.get_event_loop()` call from `coro` returns a running loop instance. On Tue, Jul 11, 2017 at 10:12 PM Chris Jerdonek wrote: > On Tue, Jul 11, 2017 at 10:20 AM, Andrew Svetlov > wrote: > > Why do you call set_event_loop() on Python 3.6 at all? > > Calling set_event_l

Re: [Async-sig] Simplifying stack traces for tasks?

2017-11-14 Thread Andrew Svetlov
print('{}'.format(frame.line)) > print('{}: {}'.format(type_.__name__, exc)) > > The meat of it is towards the bottom, "if > head.endswith('asyncio')..."There are a lot of debatable details and this > implementation is prett

Re: [Async-sig] Simplifying stack traces for tasks?

2017-11-14 Thread Andrew Svetlov
PyPI. > > On Tue, Nov 14, 2017 at 10:08 AM, Andrew Svetlov > wrote: > >> AFAIK Python never hides stdlib codelines in tracebacks. >> Why we should start to do it in asyncio? >> >> On Tue, Nov 14, 2017 at 4:54 PM Mark E. Haase wrote: >> >>> If an e

Re: [Async-sig] subclassing CancelledError

2017-12-03 Thread Andrew Svetlov
ps://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ > -- Thanks, Andrew Svetlov ___ Async-sig mailing list Async-sig@python.org https://mail.python.org/mailman/listinfo/async-sig Code of Conduct: https://www.python.org/psf/codeofconduct/

Re: [Async-sig] avoiding accidentally calling blocking code

2018-02-12 Thread Andrew Svetlov
> > Async-sig mailing list > > Async-sig@python.org > > https://mail.python.org/mailman/listinfo/async-sig > > Code of Conduct: https://www.python.org/psf/codeofconduct/ > ___ >

Re: [Async-sig] avoiding accidentally calling blocking code

2018-02-14 Thread Andrew Svetlov
work for the case I mentioned. Has anyone > started writing such a method (e.g. for certain standard lib modules)? > > --Chris > > > On Mon, Feb 12, 2018 at 11:24 PM, Andrew Svetlov > wrote: > > loop.slow_callback_duration + PYTHONASYNCIODEBUG=1 > > Does it f

Re: [Async-sig] New blog post: Notes on structured concurrency, or: Go statement considered harmful

2018-04-25 Thread Andrew Svetlov
_ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ > -- Thanks, Andrew Svetlov ___ Async-sig mai

Re: [Async-sig] "Coroutines" sometimes run without being scheduled on an event loop

2018-05-03 Thread Andrew Svetlov
havior of creating the "coroutine object" not running the > coroutine immediately. This seems like an important Gotcha waiting to > bite someone. > > Back to the scenario in the beginning. If I want to write a function > that takes coroutine objects and schedule them to run later, and some > coroutine objects turn out to be mis

Re: [Async-sig] "Coroutines" sometimes run without being scheduled on an event loop

2018-05-03 Thread Andrew Svetlov
loop is running. > > [1]: https://docs.python.org/3/library/asyncio-task.html#coroutines > > --Chris > > On Thu, May 3, 2018 at 1:24 PM, Guido van Rossum > wrote: > > Depending on the coroutine*not* running sounds like asking for trouble. > > > > On Thu, May

Re: [Async-sig] concurrency mistake

2018-08-28 Thread Andrew Svetlov
; ''' >> result >> >>> first hello >> >>> second hello >> ''' >> >> ___ >> Async-sig mailing list >> Async-sig@python.org >> https://mail.python.org/mailman/l

Re: [Async-sig] killing tasks that won't cancel

2019-02-19 Thread Andrew Svetlov
_ > Async-sig mailing list > Async-sig@python.org > https://mail.python.org/mailman/listinfo/async-sig > Code of Conduct: https://www.python.org/psf/codeofconduct/ -- Thanks, Andrew Svetlov ___ Async-sig mailing list Async-sig@p

Re: [Async-sig] killing tasks that won't cancel

2019-02-19 Thread Andrew Svetlov
Let's continue discussion on the bug tracker: https://bugs.python.org/issue32363 On Tue, Feb 19, 2019 at 10:23 PM Chris Jerdonek wrote: > > On Tue, Feb 19, 2019 at 12:10 PM Andrew Svetlov > wrote: > > If the task's function swallows CancelledError exception -- it i