[Python-bugs-list] [ python-Bugs-659604 ] optparse store_true uses 1 and 0

SourceForge.net noreply@sourceforge.net
Sun, 20 Apr 2003 19:33:22 -0700


Bugs item #659604, was opened at 2002-12-29 02:37
Message generated for change (Comment added) made by gward
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=659604&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Brian Lenihan (brianl)
Assigned to: Greg Ward (gward)
Summary: optparse store_true uses 1 and 0

Initial Comment:
When using store_true and store_false actions, the
optparse module sets the values to 1 and 0, rather than
True and False.

--- optparse.py 14 Nov 2002 22:00:19 -0000      1.1
+++ optparse.py 29 Dec 2002 07:34:06 -0000
@@ -609,9 +609,9 @@
         elif action == "store_const":
             setattr(values, dest, self.const)
         elif action == "store_true":
-            setattr(values, dest, 1)
+            setattr(values, dest, True)
         elif action == "store_false":
-            setattr(values, dest, 0)
+            setattr(values, dest, False)
         elif action == "append":
             values.ensure_value(dest, []).append(value)
         elif action == "count":

----------------------------------------------------------------------

>Comment By: Greg Ward (gward)
Date: 2003-04-20 22:33

Message:
Logged In: YES 
user_id=14422

Problems with optparse.py should be addressed via Optik's
project page, CVS archive, etc.  I've fixed Optik to use
True/False when available; that fix made it into Optik1.4.1.
 I'll be checking in a revised optparse.py based on Optik
1.4.1 real soon now (as soon as it passes its test suite).


----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-12-29 10:09

Message:
Logged In: YES 
user_id=33168

Greg, any problem with making this change?  Assign to me, if
you want me to do it.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=659604&group_id=5470