Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92848
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-06-18 12:47 -0700 |
| Message-ID | <fc770e8e-a269-4325-b211-efe09327c3ea@googlegroups.com> (permalink) |
| Subject | python program without stackless.run() |
| From | ravi <temp.sha@gmail.com> |
Hi,
I could not understand how the below program executes function "fun" without calling stackless.run() in the program? Here "fun" runs as a tasklet and as per my knowledge for that stackless.run() is must.
-----------------------------------------------------------------
import stackless
class A:
def __init__(self,name):
self.name = name
self.ch = stackless.channel()
stackless.tasklet(self.fun)()
def __call__(self,val):
self.ch.send(val)
def fun(self):
while 1:
v = self.ch.receive()
print "hi" , v
if __name__ == "__main__":
obj = A("sh")
obj(6)
-----------------------------------------------------------------
output:
----------
hi 6
thanks,
ravi
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
python program without stackless.run() ravi <temp.sha@gmail.com> - 2015-06-18 12:47 -0700
Re: python program without stackless.run() Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-18 14:10 -0600
Re: python program without stackless.run() ravi <temp.sha@gmail.com> - 2015-06-18 14:00 -0700
csiph-web