Re: Async callback in python

2006-12-06 Thread Chris Mellon
On 12/4/06, Calvin Spealman <[EMAIL PROTECTED]> wrote: > On 4 Dec 2006 20:18:22 -0800, Linan <[EMAIL PROTECTED]> wrote: > > Hi, > > > > In javascript, code could be written like this: > > > > ... > > > > var _p=XMLHttpRequest(); > > _p.open('GET',url,true); > > _p.send(null)

RE: Async callback in python

2006-12-06 Thread Sells, Fred
the standard print gets "delayed" somewhere inside python, however if you use print >>sys.stderr, "whatever", 3, 4 5 that prints immediately, or so it seems to me. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Linan Sent: Monday, December 04, 2006 11:18 P

Re: Async callback in python

2006-12-04 Thread Gabriel Genellina
At Tuesday 5/12/2006 01:18, Linan wrote: t=T('aVerySlowSite','/') asyncore.loop() for i in range(0,10): print '%d in main process' % i time.sleep(1) Suppose it's asynchronous, couple of '%d in main process' lines should be mixed in the output of T.handle_read(), right?

Re: Async callback in python

2006-12-04 Thread Felipe Almeida Lessa
On 4 Dec 2006 20:18:22 -0800, Linan <[EMAIL PROTECTED]> wrote: > 3, If not, where to get the real one(s)? After reading Calvin's mail, you may want to see http://twistedmatrix.com/ . It's an assynchronous library built around the concept of deferreds (think of callbacks). You may like it =). Cya,

Re: Async callback in python

2006-12-04 Thread Calvin Spealman
On 4 Dec 2006 20:18:22 -0800, Linan <[EMAIL PROTECTED]> wrote: > Hi, > > In javascript, code could be written like this: > > ... > > var _p=XMLHttpRequest(); > _p.open('GET',url,true); > _p.send(null); > _p.onreadystateChange=function(){ > if(_p.ready

Re: Async callback in python

2006-12-04 Thread [EMAIL PROTECTED]
Did you flush the buffer? It might be that the print statements are being called in the order you expect but that they are all written to the screen only at the end. I've had that happen before. Cheers, -T Linan wrote: > Hi, > > In javascript, code could be written like this: > > ... > > v