39710f3be8cf

Change variable names to avoid shadowing builtins.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 28 Aug 2009 20:32:18 -0400
parents 695233cc2503
children 5bfd01d9c28f
branches/tags (none)
files t.py

Changes

--- 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