monocle

An async programming framework with a blocking look-alike syntax
Download

monocle Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Steven Hazel
  • Publisher web site:
  • http://awesame.org

monocle Tags


monocle Description

An async programming framework with a blocking look-alike syntax monocle is an async programming framework with a blocking look-alike syntax.monocle straightens out event-driven code using Python's generators. It aims to be portable between event-driven I/O frameworks, and currently supports Twisted and Tornado.It's for Python 2.5 and up; the syntax it uses isn't supported in older versions of Python.A Simple ExampleHere's a simple monocle program that runs two concurrent lightweight processes (called "oroutines") using Tornado's event loop:import monoclemonocle.init("tornado")from monocle.stack import eventloopfrom monocle.util import sleep@monocle.odef seconds(): while True: yield sleep(1) print "1"@monocle.odef minutes(): while True: yield sleep(60) print "60"monocle.launch(seconds)monocle.launch(minutes)eventloop.run() Requirements: · Python


monocle Related Software