# HG changeset patch # User Steve Losh # Date 1251505938 14400 # Node ID 39710f3be8cf096abb1f6d1664faf57a93aca230 # Parent 695233cc2503440253b19f84216f7da0e718ce35 Change variable names to avoid shadowing builtins. diff -r 695233cc2503 -r 39710f3be8cf t.py --- a/t.py Wed Aug 26 18:38:48 2009 -0400 +++ b/t.py Fri Aug 28 20:32:18 2009 -0400 @@ -90,16 +90,16 @@ def add_task(self, text): """Add a new, unfinished task with the given summary text.""" - id = _hash(text) - self.tasks[id] = {'id': id, 'text': text} + task_id = _hash(text) + self.tasks[task_id] = {'id': task_id, 'text': text} def print_list(self, kind='tasks', verbose=False): """Print out a nicely formatted list of unfinished tasks.""" tasks = dict(getattr(self, kind).items()) label = 'prefix' if not verbose else 'id' if not verbose: - for id, prefix in _prefixes(tasks).items(): - tasks[id]['prefix'] = prefix + for task_id, prefix in _prefixes(tasks).items(): + tasks[task_id]['prefix'] = prefix plen = max(map(lambda t: len(t[label]), tasks.values())) if tasks else 0 for t in tasks.values(): print ('%-' + str(plen) + 's - %s') % (t[label], t['text']) @@ -111,7 +111,7 @@ will be raised. """ - matched = filter(lambda id: id.startswith(prefix), self.tasks.keys()) + matched = filter(lambda tid: tid.startswith(prefix), self.tasks.keys()) if len(matched) == 1: task = self.tasks.pop(matched[0]) self.done[task['id']] = task