True/False

Alex Martelli aleax at aleax.it
Sat Apr 26 05:41:20 EDT 2003


Andrew Clover wrote:

> A. Lloyd Flanagan <alloydflanagan at attbi.com> wrote:
> 
>> This has the advantage of making True and False look more like builtins.
> 
> Interesting. I'm not sure about this; it seems to have the potential to
> confuse other, unrelated modules. For example some package might check for
> the existence of 'True' to see whether it needs to provide its own boolean
> type that's distinguishable from integers. If the builtin is fiddled it
> would look like there was a real boolean type but attempts to use it could

Such a hypothetical "some package" would disastrously fail under Python
2.2.2, which does define a built-in True BUT doesn't have a boolean type
that is at all distinguishable from integers.  That the OP's approach
shows up the "some package"'s fault just as 2.2.2 shows it doesn't seem
to me to be worth a condemnation of that approach (nor of 2.2.2) but
rather underlines that the "some package" is broken and needs to be fixed.

> fall over. Modules that affect unrelated modules merely by being imported
> can be tricky to debug.

Sure.  But something that (e.g.) runs on 2.2.1 and simply simulates closely
an effect that an upgrade to 2.2.2 would also have doesn't seem to present
any particularly high risk in this regard.


Alex





More information about the Python-list mailing list