Twisted core has been proposed, but I believe the consensus was that
it wasn't desirable, generally.
I'm also pretty sure that people learn twisted because everyone learns
twisted. It's one of those buzz-words ;).
As for task scheduling, I believe it was something like...
import asyncore
import time
import heapq
tasks = []
def schedule(delta, callme):
heapq.heappush(tasks, (time.time()+delta, callme))
def loop_with_schedule(timeout=30):
while 1:
now = time.time()
while tasks and tasks[0][0] < now:
callme = heapq.heappop(tasks)[1]
try:
callme()
except (KeyboardInterrupt, SystemExit):
raise
except:
#do something useful
pass
thistimeout = timeout
if tasks:
thistimeout = max(min(thistimeout, tasks[0][0]-now), 0)
asyncore.poll(timeout=thistimeout)
- Josiah
On Fri, Feb 15, 2008 at 11:45 AM, Giampaolo Rodola' <[EMAIL PROTECTED]> wrote:
> On 15 Feb, 03:24, "Josiah Carlson" <[EMAIL PROTECTED]> wrote:
>
> > As I stated 2+ and 6+ months ago, the patches I submitted 9+ months
> > ago work (I've been using them in my own projects without issue). The
> > only issue with the bugfix/rearrangement that I last heard about with
> > regards to the 2.x stuff was that I removed a class that no one was
> > using in the wild, which I believe Giampaolo added in a subsequent
> > patch in the last couple months.
>
> I provided the patch for the other issue (look at what is specified in
> ac_out_buffer_size) but I didn't re-add fifo and simple_producer
> classes.
> What should be done here? Re-add or discard them?
> However, I will send to you by e-mail the modified asynchat version.
> It is based on your patch therefore a first commit could be finally
> done.
>
>
> > My suggestion:
> > 1. Apply the most recent fixes to 2.6 asyncore/asynchat that Giampaolo
> > has updated.
>
> > 1.a. Figure out what the hell is up with OOB data, how to handle it,
> > and stop making it use handle_expt().
>
> If we want to leave OOB untouched shouldn't handle_expt be the right
> place where manage such kind of events?
> Alternatively we could also remove the OOB management at all (e.g.
> Twisted does that by ignoring such kind of data).
> OOB could be actually useful to implement some protocols such as FTP
> (in details ABOR and STAT commands which require OOB data) but it
> would be probably better not having it than having it but not
> implemented properly.
> I am saying this also because later or soonish we might need to care
> of epoll and kqueue (http://bugs.python.org/issue1657).
>
>
> > * Scheduled tasks are not a valid enhancement for either; anyone who
> > wants them can trivially add them with their own asyncore.loop()
> > variant and call asyncore.poll() as necessary (I did it in about 15
> > lines in the summer of 2002, I hope others can do better now). If you
> > want my opinion on other async-related features, feel free to email me
> > directly (use the gmail address you see here, then it ends up in my
> > inbox, not the overflowing python folder).
>
> How's your solution? Could you post it here or send it to me by mail?
> IMO scheduled tasks is a very important feature for implementing a lot
> of interesting stuff like connection timeouts and bandwidth
> throttling.
> A lot of people have to learn/use Twisted just because of that.
> Moreover I think that Bill Janssen could need that feature to make the
> ssl module work with asyncore.
>
>
> PS - I have been reading this mailing list for a short time therefore
> I have no clue whether or not someone has ever thought about including
> the Twisted core - only itself - in Python stdlib.
>
>
> _______________________________________________
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/josiah.carlson%40gmail.com
>
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com