> It's not clear to me what such a PEP should address in particular,
> anyway here's a bunch of semi-random ideas.
I have been reading for perhaps a decade how bad asyncore is. So I hope
you stick with trying to thrash out something different, even if the
discussion gets tedious or contentions.
> === Idea #1 ===
>
> 4 classes (SelectPoller, PollPoller, EpollPoller, KqueuePoller) within
> concurrent.eventloop namespace all sharing the same API:
For new classes, the first question is what concept (and data/function
grouping) they and their instances represent. As a naive event loop
user, I might think in terms of event sources (or sets of sources) and
corresponding handlers. For events generated by 'file' polling, the
particular method would seem like a secondary issue.
Your proposed classes are named after methods and you give no
initialization api. This suggests to me that you mean for all files
being polled by the same method to be grouped together. If so, there
would only need 0 or 1 instance of each 'class', in while case, they
could just as well be modules.
In other words, I am unsure what concept these classes would represent.
I am perhaps thinking at too high a level.
> - register(fd, events, callback) # callback gets called with events as arg
> - modify(fd, events)
> - unregister(fd)
> - call_later(timeout, callback, errback=None)
> - call_every(timeout, callback, errback=None)
> - poll(timeout=1.0, blocking=True)
> - close()
>
> call_later() and call_every() can return an object having cancel() and
> reset() methods.
--
Terry Jan Reedy
Frankly, I don't think this deserves a PEP at all, or even to consider
one *yet*.
Building a new API and a new library from scratch seems a frail
comparison to testing
a library in the real world, it having real uses, and then being
incorporated into the
stdlib. The problem here, of course, is that all the real-world
solutions (ie, Twisted)
include far more than the reactor.
>
> --- Giampaolo
> http://code.google.com/p/pyftpdlib/
> http://code.google.com/p/psutil/
> http://code.google.com/p/pysendfile/
> _______________________________________________
> Python-ideas mailing list
> Python...@python.org
> http://mail.python.org/mailman/listinfo/python-ideas
--
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy
On Wed, May 23, 2012 at 9:32 PM, Giampaolo Rodolà <g.ro...@gmail.com> wrote:
> Users willing to support multiple event loops such as wx, gtk etc can do:
>
>>>> while 1:
> ... poller.poll(timeout=0.1, blocking=False)
> ... otherpoller.poll()
>
>
> Basically, this would be the whole API.
>
> Thoughts?
>
Frankly, I don't think this deserves a PEP at all, or even to consider
one *yet*.
Building a new API and a new library from scratch seems a frail
comparison to testing
a library in the real world, it having real uses, and then being
incorporated into the
stdlib. The problem here, of course, is that all the real-world
solutions (ie, Twisted)
include far more than the reactor.
Obviously, for a man with many opinions I miss out on too many conversations
and too many potential actions. I should make steps to correct this in
the future.
Thanks for clearing this up.
> Cheers,
> Nick.