[Distutils] Commands: init'ing booleans to None

Pearu Peterson pearu@cens.ioc.ee
Fri Mar 22 03:00:01 2002


On Thu, 21 Mar 2002, Andrew Kuchling wrote:

> There are a bunch of places in distutils.command where Boolean options
> are initialized to None; there are other places where they're
> initialized to zero.  Is it worth making this consistent, and always
> setting them to 0?  (I'm currently going through all the commands
> checking the boolean_opts class variables, so I can change the
> initializations at the same time.)

I think you should be extra careful here as some Boolean options
seem to be initialized to None and not to 0 in purpose. See for example
the `compile' option in install_lib command. If `compile is None', then it
is interpreted as "user has not explicitly disabled or enabled compile
flag" and then it is set to default value `compile = 1'. 

So, `None' is not always `0', `None' means "use default" and default may
be either 0 or 1.

How can you test that your changes will not introduce curious
and hard to find bugs?
Because there are non-trivial derivatives of distutils (like
scipy_distutils) that may also depend on the current behavior of distutils
where `None' does not necessarily mean `0'.

Regards,
	Pearu