From e1cc27677b92c5ce520c692566fd38420b70b3c7 Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Mon, 8 Mar 2010 17:40:47 +0800 Subject: Use itertools.count instead of custom counter function. --- examples/data/scripts/uzbl-event-manager | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'examples/data/scripts/uzbl-event-manager') diff --git a/examples/data/scripts/uzbl-event-manager b/examples/data/scripts/uzbl-event-manager index a0afcb3..a3fed98 100755 --- a/examples/data/scripts/uzbl-event-manager +++ b/examples/data/scripts/uzbl-event-manager @@ -39,6 +39,7 @@ from signal import signal, SIGTERM from optparse import OptionParser from traceback import print_exc from functools import partial +from itertools import count def xdghome(key, default): @@ -107,15 +108,6 @@ def error(msg): sys.stderr.write("%s: error: %s\n" % (SCRIPTNAME, msg)) -def counter(): - '''Generate unique object id's.''' - - i = 0 - while True: - i += 1 - yield i - - def find_plugins(plugin_dirs): '''Find all event manager plugins in the plugin dirs and return a dictionary of {'plugin-name.py': '/full/path/to/plugin-name.py', ...}''' @@ -322,7 +314,7 @@ def parse_msg(uzbl, msg): class EventHandler(object): - nexthid = counter().next + nexthid = count().next def __init__(self, event, handler, *args, **kargs): if not callable(handler): -- cgit v1.2.3