[Python-Dev] Boolean transition (original) (raw)
Tim Peters tim.one@comcast.net
Sat, 09 Mar 2002 21:38:28 -0500
- Previous message: [Python-Dev] Boolean transition
- Next message: [Python-Dev] Boolean transition
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Paul Prescod]
I'm in favour of adding the boolean feature in as compatible a manner as possible. But I think that we need a transition plan to separate booleans from integers. Booleans are not integers and True+True-False+5=6 is just weird. Arithmetic manipulation of booleans should be deprecated and should fade away.
I disagree. Writing "True+True-False" etc is weird, but nobody would do that except to be annoying, and there's nothing weird about identifying false/true with 0/1. It's often a useful confusion.
Java disallowed mixing ints with booleans specifically to stop the
if (x = 1)
flavor of C bug, but Python stops those via a different gimmick. There's nothing reprehensible about, e.g.,
days_in_year = 365 + is_leap(year)
or
print [("off", "on")[switch] for switch in switch_list]
Ban sensible uses, and people will just keep using integers for their true/false, on/off, set/clear etc values.
- Previous message: [Python-Dev] Boolean transition
- Next message: [Python-Dev] Boolean transition
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]