Skip to content

Should DEFINE_boolean() allow "None" as the default value? #10

@GoogleCodeExporter

Description

@GoogleCodeExporter
Currently, we can define a boolean flag with default value to None:

 FLAGS = gflags.FLAGS
 gflags.DEFINE_boolean("the_flag", None, "The flag.")

I'm not sure if this is expected or should it be allowed, since python-gflags 
project tries to mimic the C++ version of gflags as close as possible.  This is 
troublesome because user may be unaware that a boolean flag can fail both of 
the following assertions:

 assertTrue(FLAGS.the_flag)  # AssertionError: None is not True
 assertFalse(FLAGS.the_flag)  # AssertionError: None is not False

Original issue reported on code.google.com by linshu...@chromium.org on 4 Apr 2012 at 8:04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions