ImageImage

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: optparse store_true uses 1 and 0
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gward Nosy List: brianl, gward, nnorwitz
Priority: normal Keywords:

Created on 2002-12-29 07:37 by brianl, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Messages (4)
msg13698 - (view) Author: Brian Lenihan (brianl) Date: 2002-12-29 07:37
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":
msg13699 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-12-29 15:09
Logged In: YES 
user_id=33168

Greg, any problem with making this change?  Assign to me, if
you want me to do it.
msg13700 - (view) Author: Greg Ward (gward) (Python committer) Date: 2003-04-21 02:33
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).
msg13701 - (view) Author: Greg Ward (gward) (Python committer) Date: 2003-04-21 02:42
Logged In: YES 
user_id=14422

OK, fixed in rev 1.3 of optparse.py.
History
Date User Action Args
2022-04-10 16:06:03adminsetgithub: 37658
2002-12-29 07:37:14brianlcreate