ncio.wait with `FIRST_COMPLETED`;
> however, the problem is that it seems to evict the not-completed coroutines,
> so the messenger that arrives second does not send the message. To check it,
> I have run that script without the random sleep. just msgr1 waits 1s and
> msgr2 waits 2s, so
or details on the functionality of
> asyncio.wait(), see
> https://docs.python.org/3/library/asyncio-task.html#asyncio.wait.
>
> I understand that I can create two coroutines that call the same
> function, but it would be much cleaner (because of implementation issues)
> if I can
Hi everyone,
this question is sort of in response to this issue
https://github.com/gotcha/ipdb/issues/174. I've noticed that there was
recently added support for an asyncio repl (run via `python -m
asyncio`), which allows the use of `await` directly on coroutine objects
in the REPL.
But this does
”, keeping a record of Tasks that are waiting and calling "set_result"
> > on those Tasks when finished. Also Task isn’t even documented to have the
> > set_result method (though "future" is)
>
> Because Tasks are used to wrap coroutines, and the result o
en documented to have the
> set_result method (though "future" is)
Because Tasks are used to wrap coroutines, and the result of the Task
should be determined by the coroutine, not externally.
Instead of tracking tasks (that's what the event loop is for) I would
suggest trackin
Also Task isn’t even documented to have the
> set_result method (though "future" is)
I don't really get what you want to achieve. Do you want to signal other
coroutines that one of the others finished ?
From what I understand, you want to have several coroutines reading on
the
Using asyncio I am looking for a simple way to await multiple events where
notification comes over the same socket (or other serial stream) in arbitrary
order. For example, suppose I am communicating with a remote device that can
run different commands simultaneously and I don't know which comm
ou're right... I was just, you know... "Async is so cool, let's just
async everything!"
>If it were a class, then you could make the individual methods be
> coroutines if desired and await those.
Thanks for your advise Ian!
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Feb 1, 2018 at 5:38 AM, Yahya Abou 'Imran via Python-list
wrote:
> Hi guys.
>
> I am discovering coroutines and asynchronous programming, and I have a little
> problem with a little example I'm coding myself as an excercice.
>
> Let say you take two guys i
Hi guys.
I am discovering coroutines and asynchronous programming, and I have a little
problem with a little example I'm coding myself as an excercice.
Let say you take two guys in the street: Dave and Bryan.
You ask dave to count from 1 to 50, 1 by 1. He will do it fast.
And you ask Bry
Hello
Here a code for a simple demultiplexer coroutine
def demultiplexer(target1, target2):
while True:
data = yield
target1.send(data)
target2.send(data)
When data is sent to target1, what Cpython do
immediately after ?
1- Go on execute demultiplexer, so send a dat
I have just released version 4.1.1 of the decorator module. The new feature is
that it is possible to decorate coroutines. Here is an example of how
to define a decorator `log_start_stop` that can be used to trace coroutines:
$ cat x.py
import time
import logging
from asyncio import
On 23.08.2015 23:43, Charles Hixson wrote:
If I understand correctly asyncio, coroutines, etc. (and, of course,
Threads) are not simultaneously executed, and that if one wants that
one must still use multiprocessing. But I'm not sure. The note is
still there at the start of threading, s
Charles Hixson writes:
> If I understand correctly asyncio, coroutines, etc. (and, of course,
> Threads) are not simultaneously executed, and that if one wants that
> one must still use multiprocessing. But I'm not sure. The note is
> still there at the start of threading, s
If I understand correctly asyncio, coroutines, etc. (and, of course,
Threads) are not simultaneously executed, and that if one wants that one
must still use multiprocessing. But I'm not sure. The note is still
there at the start of threading, so I'm pretty sure about that
On Fri, May 8, 2015 at 9:53 PM, Dave Angel wrote:
> One thing newbies get tripped up by is having some path through their code
> that doesn't explicitly return. And in Python that path therefore returns
> None. It's most commonly confusing when there are nested ifs, and one of
> the "inner ifs"
On 05/08/2015 02:42 AM, Chris Angelico wrote:
On Fri, May 8, 2015 at 4:36 PM, Rustom Mody wrote:
On Friday, May 8, 2015 at 10:39:38 AM UTC+5:30, Chris Angelico wrote:
Why have the concept of a procedure?
On Friday, Chris Angelico ALSO wrote:
With print(), you have a conceptual procedure...
On Fri, May 8, 2015 at 4:36 PM, Rustom Mody wrote:
> On Friday, May 8, 2015 at 10:39:38 AM UTC+5:30, Chris Angelico wrote:
>> Why have the concept of a procedure?
>
> On Friday, Chris Angelico ALSO wrote:
>> With print(), you have a conceptual procedure...
>
> So which do you want to stand by?
A
On Friday, May 8, 2015 at 10:39:38 AM UTC+5:30, Chris Angelico wrote:
> Why have the concept of a procedure?
On Friday, Chris Angelico ALSO wrote:
> With print(), you have a conceptual procedure...
So which do you want to stand by?
Just to be clear I am not saying python should be any differen
On Fri, May 8, 2015 at 2:53 PM, Rustom Mody wrote:
> Yeah I know
> And if python did not try to be so clever, I'd save some time with
> student-surprises
>
>> In a program, an expression
>> statement simply discards its result, whether it's None or 42 or
>> [1,2,3] or anything else. You could writ
On Friday, May 8, 2015 at 10:24:06 AM UTC+5:30, Rustom Mody wrote:
> get is very much a function and the None return is semantically significant.
> print is just round peg -- what you call conceptual function -- stuffed into
> square hole -- function the only available syntax-category
Sorry "Conc
On Friday, May 8, 2015 at 10:04:02 AM UTC+5:30, Chris Angelico wrote:
> On Fri, May 8, 2015 at 2:06 PM, Rustom Mody wrote:
> >> > If the classic Pascal (or Fortran or Basic) sibling balanced abstractions
> >> > of function-for-value procedure-for-effect were more in the collective
> >> > consciousn
On Fri, May 8, 2015 at 2:06 PM, Rustom Mody wrote:
>> > If the classic Pascal (or Fortran or Basic) sibling balanced abstractions
>> > of function-for-value procedure-for-effect were more in the collective
>> > consciousness rather than C's travesty of function, things might not have
>> > been so
On Wednesday, May 6, 2015 at 6:41:38 PM UTC+5:30, Dennis Lee Bieber wrote:
> On Tue, 5 May 2015 21:47:17 -0700 (PDT), Rustom Mody declaimed the following:
>
> >If the classic Pascal (or Fortran or Basic) sibling balanced abstractions of
> >function-for-value
> >procedure-for-effect were more in t
On Wednesday, May 6, 2015 at 11:19:07 AM UTC+5:30, Steven D'Aprano wrote:
> On Wednesday 06 May 2015 14:47, Rustom Mody wrote:
>
> > It strikes me that the FP crowd has stretched the notion of function
> > beyond recognition And the imperative/OO folks have distorted it beyond
> > redemption.
>
>
On Wednesday 06 May 2015 14:47, Rustom Mody wrote:
> It strikes me that the FP crowd has stretched the notion of function
> beyond recognition And the imperative/OO folks have distorted it beyond
> redemption.
In what way?
> And the middle road shown by Pascal has been overgrown with weeds for
On Tuesday, May 5, 2015 at 11:15:42 PM UTC+5:30, Marko Rauhamaa wrote:
> Personally, I have never found futures a very useful idiom in any
> language (Scheme, Java, Python). Or more to the point, concurrency and
> the notion of a function don't gel well in my mind.
Interesting comment.
It strik
On 5/5/2015 1:46 PM, Ian Kelly wrote:
On Tue, May 5, 2015 at 9:22 AM, Paul Moore wrote:
I'm working my way through the asyncio documentation. I have got to the "Tasks and
coroutines" section, but I'm frankly confused as to the difference between the
various things descr
K, that makes a lot of sense. There seems to be two distinct strands within
the asyncio world, the callback model and the task/coroutine model. AIUI,
coroutines/tasks are supposed to let you avoid callbacks.
So I guess in that model, a Future isn't something you should use directly in
task-b
On Tuesday, 5 May 2015 17:11:39 UTC+1, Zachary Ware wrote:
>On Tue, May 5, 2015 at 10:22 AM, Paul Moore wrote:
>> I'm working my way through the asyncio documentation. I have got to the
>> "Tasks and coroutines" section, but I'm frankly confused as to the
>&
Paul> ... I'm frankly confused ...
You and me both. I'm pretty sure I understand what a Future is, and
until the long discussion about PEP 492 (?) started up, I thought I
understood what a coroutine was from my days in school many years ago.
Now I'm not so sure.
Calling Dave Beazley... Calling Da
Paul Moore :
> But I don't understand what a Future is.
A future stands for a function that is scheduled to execute in the
background.
Personally, I have never found futures a very useful idiom in any
language (Scheme, Java, Python). Or more to the point, concurrency and
the notion of a functio
On Tue, May 5, 2015 at 9:22 AM, Paul Moore wrote:
> I'm working my way through the asyncio documentation. I have got to the
> "Tasks and coroutines" section, but I'm frankly confused as to the difference
> between the various things described in that section: coro
On 5/5/2015 11:22 AM, Paul Moore wrote:
I'm working my way through the asyncio documentation. I have got to
the "Tasks and coroutines" section, but I'm frankly confused as to
the difference between the various things described in that section:
coroutines, tasks, and f
On Tue, May 5, 2015 at 10:22 AM, Paul Moore wrote:
> I'm working my way through the asyncio documentation. I have got to the
> "Tasks and coroutines" section, but I'm frankly confused as to the difference
> between the various things described in that section: coro
I'm working my way through the asyncio documentation. I have got to the "Tasks
and coroutines" section, but I'm frankly confused as to the difference between
the various things described in that section: coroutines, tasks, and futures.
I think can understand a coroutine. Cor
Marko Rauhamaa :
> The asyncio module comes with coroutine support. Investigating the
> topic on the net reveals that FSM's are for old people and the brave
> new world uses coroutines. Unfortunately, all examples I could find
> seem to be overly simplistic, and I'm left th
The asyncio module comes with coroutine support. Investigating the topic
on the net reveals that FSM's are for old people and the brave new world
uses coroutines. Unfortunately, all examples I could find seem to be
overly simplistic, and I'm left thinking coroutines have few practic
On Mon, Jan 06, 2014 at 09:15:56PM -0600, Skip Montanaro wrote:
> From the couple responses I've seen, I must have not made myself
> clear. Let's skip specific hypothetical tasks. Using coroutines,
> futures, or other programming paradigms that have been introduced in
> recen
On Mon, Jan 06, 2014 at 06:56:00PM -0600, Skip Montanaro wrote:
> So, I'm looking for a little guidance. It seems to me that futures,
> coroutines, and/or the new Tulip/asyncio package might be my salvation, but
> I'm having a bit of trouble seeing exactly how that would work.
On 2014-01-07 02:29, Cameron Simpson wrote:
On 06Jan2014 18:56, Skip Montanaro wrote:
[...]
Let's say I have a dead simple GUI with two buttons labeled, "Do A" and "Do
B". Each corresponds to executing a particular activity, A or B, which take
some non-zero amount of time to complete (as percei
>From the couple responses I've seen, I must have not made myself
clear. Let's skip specific hypothetical tasks. Using coroutines,
futures, or other programming paradigms that have been introduced in
recent versions of Python 3.x, can traditionally event-driven code be
written in
On 07Jan2014 13:29, I wrote:
> def do_A():
> with lock_B():
> with lock_A():
> _do_A()
Um, of course there would be a cancel_B() up front above, like this:
def do_A():
cancel_B()
with lock_B():
with lock_A():
_do_A()
I'm with MRAB: you don't really nee
On 06Jan2014 18:56, Skip Montanaro wrote:
[...]
> Let's say I have a dead simple GUI with two buttons labeled, "Do A" and "Do
> B". Each corresponds to executing a particular activity, A or B, which take
> some non-zero amount of time to complete (as perceived by the user) or
> cancel (as perceive
ying, breaking up my
calculations into various pieces, and thus having my algorithm scattered
all over the place.
So, I'm looking for a little guidance. It seems to me that futures,
coroutines, and/or the new Tulip/asyncio package might be my salvation,
but I'm having a bit of trouble
us pieces, and
thus having my algorithm scattered all over the place.
So, I'm looking for a little guidance. It seems to me that futures,
coroutines, and/or the new Tulip/asyncio package might be my salvation, but
I'm having a bit of trouble seeing exactly how that would work. Let me
outli
I
>>> updated the gist. The other two cases still seem weird to me though. I
>>> also added a possible fix for python 2 behaviour in a separate script,
>>> though I'm not sure that the best way of implementing poor man's yield from.
>> I don't see a
python 2 behaviour in a separate script,
>> though I'm not sure that the best way of implementing poor man's yield from.
> I don't see any problems here. The context managers in question are
> created in separate coroutines and stored on separate stacks, so there
> is no
an's yield from.
I don't see any problems here. The context managers in question are
created in separate coroutines and stored on separate stacks, so there
is no "inner" and "outer" context in the thread that you posted. I
don't believe that they are guarante
eems to leak memory when generators and context managers are used this way.
>
> Are these behaviours intentional? How much of it is
> implementation-dependent? Are they documented somewhere? Neither PEP-342
> nor PEP-380 talk about context managers and PEP-343 talks about
> generator
? Are they documented somewhere? Neither PEP-342
nor PEP-380 talk about context managers and PEP-343 talks about
generators but not coroutines.
My humble opinion:
1) All three should behave in the exact same way.
2) Throwing into a generator should not yield None before throwing.
Best,
Burak
ps
Hi,
The question is in the title, is there any coroutine framework available
for Python 3.2+ ? I checked gevent and eventlet but none of them seems
to have a Py3k version.
Thanks,
--
http://mail.python.org/mailman/listinfo/python-list
I posted this message earlier to the list, but realized that URLs appear
broken with '.' at the end of URL. Sorry for that mistake and this duplicate!
asyncoro is a framework for developing concurrent programs with
asynchronous event completions and coroutines. Asynchronous
completions
asyncoro is a framework for developing concurrent programs with
asynchronous event completions and coroutines. Asynchronous
completions currently implemented in asyncoro are socket I/O
operations, sleep timers, (conditional) event notification and
semaphores. Programs developed with asyncoro will
planation. Thanks for the investigation...
> IMHO, coroutines are the one time during the PEP-era that Python can
> be accused of feature creep. All other changes seemed driven by
> thoughtful analysis, this one seemed like it was, "OMG that would be
> totally cool". PEP 34
On Jun 16, 5:03 am, Jérôme Mainka wrote:
> Hello,
>
> I try to experiment with coroutines and I don't understand why this
> snippet doesn't work as expected... In python 2.5 and python 2.6 I get
> the following output:
>
> 0
> Exception exceptions.TypeError: &quo
On 06/16/2010 06:35 PM, Steven D'Aprano wrote:
> On Wed, 16 Jun 2010 05:03:13 -0700, Jérôme Mainka wrote:
>
>> Hello,
>>
>> I try to experiment with coroutines and I don't understand why this
>> snippet doesn't work as expected... In python 2.5
On Jun 16, 6:35 pm, Steven D'Aprano wrote:
> How bizarre is that?
Sure...
> I have to say that your code is horribly opaque and unclear to me.
Welcome to the coroutines world :-)
This is mainly a pipeline where each function suspends execution
waiting for data (yield), and fe
On Wed, 16 Jun 2010 05:03:13 -0700, Jérôme Mainka wrote:
> Hello,
>
> I try to experiment with coroutines and I don't understand why this
> snippet doesn't work as expected... In python 2.5 and python 2.6 I get
> the following output:
>
> 0
> Exception except
On 06/16/2010 02:03 PM, Jérôme Mainka wrote:
> Hello,
>
> I try to experiment with coroutines and I don't understand why this
> snippet doesn't work as expected... In python 2.5 and python 2.6 I get
> the following output:
>
> 0
> Exception exceptions.Ty
Hello,
I try to experiment with coroutines and I don't understand why this
snippet doesn't work as expected... In python 2.5 and python 2.6 I get
the following output:
0
Exception exceptions.TypeError: "'NoneType' object is not callable" in
ignored
The TypeError e
On Sep 12, 8:08 pm, [EMAIL PROTECTED] wrote:
> First off, I'm a python n00b, so feel free to comment on anything if
> I'm doing it "the wrong way." I'm building a discrete event simulation
> tool. I wanted to use coroutines. However, I want to know if there
On Sep 13, 2:08 am, [EMAIL PROTECTED] wrote:
> First off, I'm a python n00b, so feel free to comment on anything if
> I'm doing it "the wrong way." I'm building a discrete event simulation
> tool. I wanted to use coroutines. However, I want to know if there
On Sep 12, 9:08 pm, [EMAIL PROTECTED] wrote:
> First off, I'm a python n00b, so feel free to comment on anything if
> I'm doing it "the wrong way." I'm building a discrete event simulation
> tool. I wanted to use coroutines. However, I want to know if there
On Sep 12, 8:08 pm, [EMAIL PROTECTED] wrote:
> First off, I'm a python n00b, so feel free to comment on anything if
> I'm doing it "the wrong way." I'm building a discrete event simulation
> tool. I wanted to use coroutines. However, I want to know if there
First off, I'm a python n00b, so feel free to comment on anything if
I'm doing it "the wrong way." I'm building a discrete event simulation
tool. I wanted to use coroutines. However, I want to know if there's
any way to hide a yield statement.
I have a class t
> Anyway, if you have a blocking operation, the only solution is to use
> a thread or a separate process.
>
> Michele Simionato
That's what I thought. It was in fact rather obvious, but I wanted to
be sure that I hadn't overlooked some arcane possibility (ex. with the
use of exceptions or somet
On Apr 23, 8:26 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On Wed, 23 Apr 2008 10:53:03 -0700 (PDT), Michele Simionato:
> You could have #2. It's a trivial variation of sending a value. For
> example,
>
> http://twistedmatrix.com/trac/browser/trunk/twisted/internet/defer.py...
>
> Jean-
On Wed, 23 Apr 2008 10:53:03 -0700 (PDT), Michele Simionato <[EMAIL PROTECTED]>
wrote:
On Apr 23, 4:17 pm, [EMAIL PROTECTED] wrote:
I would really like to know more about python 2.5's new generator
characteristics that make them more powerful and analogous to
coroutines. Is it p
On Apr 23, 4:17 pm, [EMAIL PROTECTED] wrote:
> I would really like to know more about python 2.5's new generator
> characteristics that make them more powerful and analogous to
> coroutines. Is it possible for instance to employ them in situations
> where I would normally us
On Wed, 23 Apr 2008 07:17:46 -0700 (PDT), [EMAIL PROTECTED] wrote:
I would really like to know more about python 2.5's new generator
characteristics that make them more powerful and analogous to
coroutines. Is it possible for instance to employ them in situations
where I would normally
[EMAIL PROTECTED] schrieb:
I would really like to know more about python 2.5's new generator
characteristics that make them more powerful and analogous to
coroutines. Is it possible for instance to employ them in situations
where I would normally use a thread with a blocking I/O (or s
I would really like to know more about python 2.5's new generator
characteristics that make them more powerful and analogous to
coroutines. Is it possible for instance to employ them in situations
where I would normally use a thread with a blocking I/O (or socket)
operation? If it is,
Marshall T. Vandegrift wrote:
> I'd seen the consumer decorator, and it certainly is cleaner than
> just using a generator. I don't like how it hides the parameter
> signature in the middle of the consumer function though, and it
> also doesn't provide for argument default values.
Mh, that may
Bjoern Schliessmann <[EMAIL PROTECTED]> writes:
> The solution I'd use is a decorator that calls next automatically one
> time after instantiation. Then you can use send normally, and don't
> have to care about any initial parameters, which makes the code
> clearer (initial parameters should be us
Marshall T. Vandegrift wrote:
> Without the decorator that becomes:
>
> gen = nextn(2)
> print gen.next() # => [0, 1]
> print gen.send(3) # => [2, 3, 4]
> print gen.send(1) # => [5]
>
> The former is just that smidgen nicer, and allows you to continue
> to make use of argument de
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> Do you really need a generator or co-routine to do this? Maybe
> you can just use a closure:
For my trivial example, sure -- there are lots of ways to do it. Here's
a slightly better example: the `read' method of a file-like object which
sequent
On Aug 15, 3:37 pm, "Marshall T. Vandegrift" <[EMAIL PROTECTED]>
wrote:
> Bjoern Schliessmann <[EMAIL PROTECTED]> writes:
> >> I'm trying to write a decorator which allows one to produce simple
> >> coroutines by just writing a function as a
Bjoern Schliessmann <[EMAIL PROTECTED]> writes:
>> I'm trying to write a decorator which allows one to produce simple
>> coroutines by just writing a function as a generator expression
>> which re-receives it's arguments as a tuple from each yield.
>
Marshall T. Vandegrift wrote:
> I'm trying to write a decorator which allows one to produce simple
> coroutines by just writing a function as a generator expression
> which re-receives it's arguments as a tuple from each yield.
May I ask why? Passing it the same arguments
Hi,
I'm trying to write a decorator which allows one to produce simple
coroutines by just writing a function as a generator expression which
re-receives it's arguments as a tuple from each yield. For example:
@coroutine
def nextn(n=1):
values = []
81 matches
Mail list logo