commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3650 - gnuradio/branches/developers/eb/digital-wip/gn


From: eb
Subject: [Commit-gnuradio] r3650 - gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio
Date: Tue, 26 Sep 2006 19:22:54 -0600 (MDT)

Author: eb
Date: 2006-09-26 19:22:54 -0600 (Tue, 26 Sep 2006)
New Revision: 3650

Modified:
   
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/modulation_utils.py
Log:
Changed semantics of None value in options.  If option is None,
the option is not inserted into the dictionary.


Modified: 
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/modulation_utils.py
===================================================================
--- 
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/modulation_utils.py
   2006-09-25 23:47:24 UTC (rev 3649)
+++ 
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/python/gnuradio/modulation_utils.py
   2006-09-27 01:22:54 UTC (rev 3650)
@@ -56,8 +56,15 @@
     will be populated with key/value pairs where the keys are those
     that are common to the function's argument list (minus the
     excluded_args) and the attributes in options.  The values are the
-    corresponding values from options.
+    corresponding values from options unless that value is None.
+    In that case, the corresponding dictionary entry is not populated.
 
+    (This allows different modulations that have the same parameter
+    names, but different default values to coexist.  The downside is
+    that --help in the option parser will list the default as None,
+    but in that case the default provided in the __init__ argument
+    list will be used since there is no kwargs entry.)
+
     @param function: the function whose parameter list will be examined
     @param excluded_args: function arguments that are NOT to be added to the 
dictionary
     @type excluded_args: sequence of strings
@@ -69,5 +76,6 @@
     d = {}
     for kw in [a for a in args if a not in excluded_args]:
         if hasattr(options, kw):
-            d[kw] = getattr(options, kw)
+            if getattr(options, kw) is not None:
+                d[kw] = getattr(options, kw)
     return d





reply via email to

[Prev in Thread] Current Thread [Next in Thread]