Hacker News new | past | comments | ask | show | jobs | submit login

Stackless Python makes a lot of these possible without fancy generator tricks. Not that I don't love fancy generator tricks, but I think the stackless model is more intuitive.



Can you provide a more explicit example, perhaps a Stackless alternative to one of the ones from Beazley's page?


The most obvious is coroutines:

  def ping():
      while ping_channel.receive(): #blocks here
          print "PING"
          pong_channel.send("from ping")

  def pong():
      while pong_channel.receive():
          print "PONG"
          ping_channel.send("from pong")
Most of the things that he has in there don't need to be done with generators, though generators make it more efficient and arguably cleaner. However, sometimes generators are just a twisted workaround for controlling program flow. Channels and tasklets in Stackless express program flow very well, in my opinion.

You can see more of what stackless has to offer here: http://members.verizon.net/olsongt/stackless/why_stackless.h...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: