fix handling of 0 and 1 as int parameters
authorAlexander Solovyov <piranha@piranha.org.ua>
Sat, 27 Jun 2009 19:32:48 +0300
changeset 17 5736d050a5a4
parent 16 4c5c6e56c903
child 18 04881fa9e4f3
fix handling of 0 and 1 as int parameters They were converted to True/False in case of 'value in tuple' comparison, so switch to 'value is value' is necessary.
fancyopts.py
--- a/fancyopts.py	Fri Jun 26 10:03:21 2009 +0300
+++ b/fancyopts.py	Sat Jun 27 19:32:48 2009 +0300
@@ -141,7 +141,7 @@
             state[pyname] = default
 
         # getopt wants indication that it takes a parameter
-        if default not in (None, True, False):
+        if not (default is None or default is True or default is False):
             if short: short += ':'
             if name: name += '='
         if short: