Better naming for variables in parse
authorAlexander Solovyov <piranha@piranha.org.ua>
Wed, 03 Jun 2009 23:01:50 +0300
changeset 8 4e61d2809507
parent 7 eda828775a98
child 9 7fb313fccdeb
Better naming for variables in parse
fancyopts.py
--- a/fancyopts.py	Wed Jun 03 22:42:11 2009 +0300
+++ b/fancyopts.py	Wed Jun 03 23:01:50 2009 +0300
@@ -112,20 +112,20 @@
     shortlist = ''
     namelist = []
 
-    for short, oname, default, comment in options:
+    for short, name, default, comment in options:
         # change name to match Python styling
-        name = oname.replace('-', '_')
-        argmap['-' + short] = argmap['--' + oname] = name
-        state[name] = default
+        pyname = name.replace('-', '_')
+        argmap['-' + short] = argmap['--' + name] = pyname
+        defmap[pyname] = default
 
         # getopt wants indication that it takes a parameter
         if default not in (None, True, False):
             if short: short += ':'
-            if oname: oname += '='
+            if name: name += '='
         if short:
             shortlist += short
         if name:
-            namelist.append(oname)
+            namelist.append(name)
 
     opts, args = getopt.gnu_getopt(args, shortlist, namelist)