Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91463

Re: Logic problem: need better logic for desired thruth table.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'bash': 0.07; 'javascript,': 0.07; 'plenty': 0.07; 'sanity': 0.07; 'php,': 0.09; 'ruby,': 0.09; 'scripting': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'index': 0.13; 'java,': 0.15; '(usually)': 0.16; '[1].': 0.16; 'beaten': 0.16; 'boolean': 0.16; 'comparison.': 0.16; 'different,': 0.16; 'dwarfed': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'margins': 0.16; 'nudge': 0.16; 'objective-c,': 0.16; 'wrote:': 0.16; 'comparing': 0.18; 'subject:need': 0.18; 'shell': 0.18; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'do.': 0.22; 'fairly': 0.22; 'java': 0.22; "aren't": 0.22; 'c++,': 0.22; 'exceptions': 0.22; 'subject:problem': 0.22; 'code.': 0.23; '2015': 0.23; 'split': 0.23; 'seems': 0.24; 'header:In-Reply- To:1': 0.24; 'tim': 0.24; 'script': 0.25; 'chris': 0.26; 'not,': 0.27; 'css': 0.27; 'said,': 0.27; 'message-id:@mail.gmail.com': 0.28; "i'm": 0.29; '(maybe': 0.29; 'chase': 0.29; 'perl': 0.29; 'unlikely': 0.29; 'convention': 0.31; 'fri,': 0.31; 'programmers': 0.31; 'error.': 0.31; 'implement': 0.32; '[1]': 0.32; 'though,': 0.32; 'common': 0.33; 'though.': 0.33; 'languages': 0.34; 'received:google.com': 0.34; 'next': 0.35; 'c++': 0.35; 'false': 0.35; 'but': 0.36; 'there': 0.36; 'two': 0.37; 'should': 0.37; 'subject:: ': 0.37; 'rather': 0.38; 'pm,': 0.39; 'easily': 0.39; 'sure': 0.40; 'ten': 0.60; 'your': 0.60; 'even': 0.61; 'simple': 0.61; 'taking': 0.62; 'today,': 0.62; 'safe': 0.63; 'exceed': 0.66; 'eight': 0.72; 'chrisa': 0.84; 'to:none': 0.90; 'careful': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=XYxUkMQlpVXP6eBMBhGxWo5R9W4klfXIw17KH6uWIto=; b=rN8O0PN0HgwoG/A6gSD2cz4UY2evYA3DnKXgFlNr3d20zQCw2jmqcoVW6TBQGqDyPe T6NJPyVlgjvD6F4LnHo+73OtgoLIBHBWOaKcrGI6WBhyEXF3Ex6CepFoOm/jvb+RNvOW JajcMik+P4Fa8u3Y8+Lf+AOe+RdtVN0lAaHUjf7y49VnuoTwKsZY2qwh18GmUTYAtoGU j9jFQqujrwIm2evnm4EbH3QjXnemUIxgnCEiN0RUi7MQLZgQb/fmALMub5W0R2jZqE7b PfVfRRRGFEhgvddb8w3xmsWKsynA+epePgkgbFTxnaxOHLXFF/QUt8l0/FWZuy5hwjDf 3wCg==
MIME-Version 1.0
X-Received by 10.50.43.196 with SMTP id y4mr4416178igl.14.1432910338657; Fri, 29 May 2015 07:38:58 -0700 (PDT)
In-Reply-To <20150529055315.5334cfeb@bigbox.christie.dr>
References <1432869619.871453.281061217.70B58077@webmail.messagingengine.com> <CAPTjJmpRycvcU_v4W3PQcn3gB2qeReQnTKg3u6beXT-BQrBDwg@mail.gmail.com> <20150529055315.5334cfeb@bigbox.christie.dr>
Date Sat, 30 May 2015 00:38:58 +1000
Subject Re: Logic problem: need better logic for desired thruth table.
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.185.1432910840.5151.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432910840 news.xs4all.nl 2839 [2001:888:2000:d::a6]:49495
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91463

Show key headers only | View raw


On Fri, May 29, 2015 at 8:53 PM, Tim Chase
<python.list@tim.thechases.com> wrote:
> On 2015-05-29 13:48, Chris Angelico wrote:
>> That said, though, using 0 for False and 1 for True is easily
>> the most common convention in use today, and the next most likely
>> case is that comparing booleans would give a simple and immediate
>> error. So it's most likely to be safe to do.
>
> There are popular exceptions though. coughshellscriptingcough

Yes, so you'd have to be careful if you port your complex script to
bash [1]. I'm also not sure how you'd even implement the comparison.
But shell scripting is still dwarfed by languages in which false is 0
and true is (usually) 1. Using Redmonk rankings:

1 JavaScript
2 Java
3 PHP
4 Python
5 C#
5 C++
5 Ruby
8 CSS
9 C
10 Objective-C
11 Perl
11 Shell

I'm not sure about Ruby, and I don't think CSS has a concept of
boolean arithmetic, but ten languages outrank shell scripting (Perl is
tied) and of them eight (maybe nine) use 0/1. Using langpop.com stats,
shell scripting comse up rather higher, but it's still beaten out -
and by considerable margins - by C, Java, PHP, JavaScript, C++, and
Python, all of which use 0/1. The Tiobe index seems to split up
several shells, which penalizes them severely (Bourne shell and bash
both come up in the 51-100 range), but even if they were merged,
they're unlikely to be able to nudge out the top five of Java, C, C++,
Objective-C, and C#. So while it's clearly false to state that 0/1 is
the _only_ convention in use today, it's fairly justifiably the _most
common_.

And of course, there are plenty of historical systems that were
different, as have been mentioned. But most programmers aren't going
to come across those... I hope!

ChrisA

[1] You'd also have to be insane. A bash script should not, in my
opinion, exceed about a page or two of code. I'm not sure how large a
bash script has to be before it collapses under its own gravity and
forms a black hole out of which no comprehension or sanity can escape,
but I'm taking no chances.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Logic problem: need better logic for desired thruth table. Chris Angelico <rosuav@gmail.com> - 2015-05-30 00:38 +1000

csiph-web