ACCEPTED: PEP 285
Kris J. Zaragoza
kzaragoza at attbi.com
Wed Apr 3 23:59:24 EST 2002
In article <7xy9g4nk9w.fsf at ruckus.brouhaha.com>, Paul Rubin wrote:
> I think there will need to be a format code for truth values:
>
> ("%b" % True) => "True"
>
> etc.
Maybe, but I'm not sure this is strictly necessary, since according to
the PEP:
("%s" % str(True)) => "True"
It's not as pretty as having a format specifier for it, but I'd
imagine it will do for the short term. Then, of course, you have to
wonder what exactly
("%d" % True) => ?
should print. After all, bools are ints too. Should this be "1" or
an error of some sort? And what if you've done some arithmetic on a
bool and end up with another value? What would your proposed %b
format specifier print for
val = int.__new__(bool,42)
("%b" % val) => ?
I really should stop thinking about these things and just go to
bed... :-)
-Kris
--
Kris J. Zaragoza | On the face of it, Microsoft complaining about
kzaragoza at attbi.com | the source license used by Linux is like the
| event horizon calling the kettle black.
| -- Adam Barr, article on kuro5hin.org
More information about the Python-list
mailing list