[Twisted-Python] simple global counter

Tim Allen screwtape at froup.com
Mon Sep 14 18:47:58 MDT 2009


On Mon, Sep 14, 2009 at 10:09:38PM +0700, Artem Bokhan wrote:
> May somebody give a sample code of simple global counter which could be 
> used with twisted (non-web) enviroment?

I'm not sure what you mean. If you want to keep a count of something, you can just
store it in a variable like anything else.

    event_counter = 0

    def handle_event(event):
	global event_counter

	event.do_something()
	event_counter += 1




More information about the Twisted-Python mailing list