PEP 285: Adding a bool type

Hernan M. Foffani hfoffani at yahoo.com
Sun Mar 31 06:44:18 EST 2002


"phil hunt" escribió en el mensaje
> ....
>
> I've gone through some of my herbivore code, looking to see where
> I've used 0 or 1 as a boolean. Example 1:
>
> debug = 0  # debugging this module?
>
> Frankly, if that is unclear to anyone, they are not cut out to be a
> programmer. Bear in mind that most non-programmers are aware of the
> 0/1 paradigm for boolean values: it appears on much electrical
> equipment.
>
> [an example of a "log" flag follows]

Actually "debug" and "log" flags use to be confusing if the original
author didn't document the use case. Those can be either boolean
flags or integers level indicators.

For instance, in your example the "debug = 0" may have both meanings.
It's the "?" in the commentary that raises the bets towards boolean.

It's a very common practice to start with a boolean meaning and
"promote" it afterwards to a level parameter. I'm not judging that
practice here because I don't think it is a problem, it just works.

Regards,
-Hernan







More information about the Python-list mailing list