[Twisted-Python] simple global counter
art at academ.org
Tue Sep 15 05:54:09 EDT 2009
Tim Allen пишет:
> 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.
I want find out if it's possible to count things in context of the
whole twisted server, not just one tcp session.
> 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_counter += 1
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
More information about the Twisted-Python