Skip to content

optparse store_true uses 1 and 0 #37658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brianl mannequin opened this issue Dec 29, 2002 · 4 comments
Closed

optparse store_true uses 1 and 0 #37658

brianl mannequin opened this issue Dec 29, 2002 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@brianl
Copy link
Mannequin

brianl mannequin commented Dec 29, 2002

BPO 659604

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2003-04-21.02:42:59.000>
created_at = <Date 2002-12-29.07:37:14.000>
labels = ['library']
title = 'optparse store_true uses 1 and 0'
updated_at = <Date 2003-04-21.02:42:59.000>
user = 'https://bugs.python.org/brianl'

bugs.python.org fields:

activity = <Date 2003-04-21.02:42:59.000>
actor = 'gward'
assignee = 'gward'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2002-12-29.07:37:14.000>
creator = 'brianl'
dependencies = []
files = []
hgrepos = []
issue_num = 659604
keywords = []
message_count = 4.0
messages = ['13698', '13699', '13700', '13701']
nosy_count = 3.0
nosy_names = ['nnorwitz', 'gward', 'brianl']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue659604'
versions = ['Python 2.3']

@brianl
Copy link
Mannequin Author

brianl mannequin commented Dec 29, 2002

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":

@brianl brianl mannequin closed this as completed Dec 29, 2002
@brianl brianl mannequin assigned gward Dec 29, 2002
@brianl brianl mannequin added the stdlib Python modules in the Lib dir label Dec 29, 2002
@brianl brianl mannequin closed this as completed Dec 29, 2002
@brianl brianl mannequin assigned gward Dec 29, 2002
@brianl brianl mannequin added the stdlib Python modules in the Lib dir label Dec 29, 2002
@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Dec 29, 2002

Logged In: YES
user_id=33168

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

@gward
Copy link
Mannequin

gward mannequin commented Apr 21, 2003

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).

@gward
Copy link
Mannequin

gward mannequin commented Apr 21, 2003

Logged In: YES
user_id=14422

OK, fixed in rev 1.3 of optparse.py.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

0 participants