PEP 285: Adding a bool type
Christian Tanzer
tanzer at swing.co.at
Sat Mar 30 02:38:01 EST 2002
Erik Max Francis <max at alcyone.com> wrote:
> > Because the repr() or str() of a bool value is different from an
> > int value, some code (for example doctest-based unit tests, and
> > possibly database code that relies on things like "%s" % truth)
> > may fail. How much of a backwards compatibility problem this will
> > be, I don't know. If we this turns out to be a real problem, we
> > could changes the rules so that str() of a bool returns "0" or
> > "1", while repr() of a bool still returns "False" or "True".
>
> Where is the backward compatibility problem for using bool? At present,
> no one uses it, so none of their types will be bools (right?). Even if
> they happen to use the values True and False (or whatever gets adopted),
> those can be overridden just like None, so if they define and use them
> they should get their values, not Python's. Right?
The value of `"%s" (not x, )` is going to change. Any code depending
on the old way will break.
--
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list
mailing list