Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

a light-weight event handler

Project Description

Teventlet provides a light-weight easy-to-use mechenism for handling events. Each eventlet object is it’s own event, to which you can add callbacks with +=. To call the event, you can call the object with any arguments, or call the invoke method with any arguments.


The purpose of Teventlet is to provide a mechenism that can be used to handle events. For example, if you wanted to attach events to an object in a game, for events such as collisions, you would have a teventlet per event. The publisher (in this case whatever checks for collisions) would be responsible for calling the invoke method on the event, while anything wanting to know when a collision occured would add a method to the callback list with the += operator.


Here is a quick example to get you going.:

>>> from __future__ import print_function
>>> from teventlet import teventlet
>>> adder = teventlet(lambda x:print(x+1), lambda x:print(x+2))
>>> adder.invoke(2)
>>> len(adder)

As you can see, we pass two lambdas to the adder: a lambda that prints x+1, and a lambda that prints x+2. You could easily replace these with functions. By calling invoke, we pass in an argument that gets sent to our lambdas. You can also call the event as if it were a function.:

>>> adder(5)

See Also

I have written a blog post, which can be found at This gives some more examples of how to use Teventlet, as well as explains it’s purpose in more detail.

Release History

This version
History Node


History Node


Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting