A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-March/020850.html below:

[Python-Dev] Boolean transition

[Python-Dev] Boolean transitionTim Peters tim.one@comcast.net
Sat, 09 Mar 2002 21:38:28 -0500
[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.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4