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


Groups > comp.lang.python > #5284

Re: checking if a list is empty

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python,': 0.01; '*not*': 0.05; 'typing': 0.05; 'indentation': 0.07; 'type,': 0.07; 'python': 0.07; 'enjoys': 0.09; 'implicitly': 0.09; 'pm,': 0.11; 'c++': 0.12; 'wrote:': 0.14; '*it': 0.16; 'allowed,': 0.16; 'boolean': 0.16; 'empty"': 0.16; 'exploits': 0.16; 'first-class': 0.16; 'habits': 0.16; 'python;': 0.16; 'tempted': 0.16; 'argument': 0.16; 'expressions': 0.19; 'yet.': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'cheers,': 0.20; 'language': 0.20; 'programming': 0.20; 'subject:list': 0.22; 'header:In-Reply- To:1': 0.22; 'cc:addr:python-list': 0.22; 'thu,': 0.22; 'received:209.85.213': 0.23; 'thus': 0.24; 'url:wiki': 0.24; 'regardless': 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'url:edu': 0.28; 'scientific': 0.29; 'problem': 0.29; "python's": 0.29; 'least': 0.30; 'yet': 0.30; 'cc:addr:python.org': 0.31; '"in': 0.31; 'enabled': 0.31; 'fails.': 0.31; 'more)': 0.31; '\xe2\x80\x94': 0.31; 'fact': 0.31; "skip:' 10": 0.32; 'another': 0.32; 'minor': 0.33; 'community': 0.33; 'chosen': 0.33; 'there': 0.35; 'explicit': 0.35; 'languages.': 0.35; 'quite': 0.36; 'think': 0.36; 'some': 0.37; 'received:209.85': 0.37; '(to': 0.38; 'received:google.com': 0.38; 'less': 0.38; 'but': 0.38; 'languages': 0.38; 'towards': 0.38; 'so,': 0.38; 'larger': 0.39; 'could': 0.39; 'received:209': 0.39; 'add': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'domain': 0.40; 'might': 0.40; 'later,': 0.60; 'simple,': 0.60; 'simple': 0.60; 'fact,': 0.60; 'reached': 0.61; 'design': 0.61; 'give': 0.61; '2011': 0.62; 'natural': 0.63; 'url:cgi': 0.65; 'alternative': 0.69; '100': 0.70; 'hate': 0.73; '11:46': 0.84; 'barrier': 0.84; 'conceived': 0.84; 'exotic': 0.84; 'grave': 0.84; 'heck,': 0.84; 'ironic': 0.84; 'namely': 0.84; 'radical': 0.84; 'century': 0.91; 'victims': 0.91; 'old.': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=AdqYTZO6iGJrXRW+8GwKj70Kd5BzI8ISqddbFcSww3Q=; b=AwfSpTHSxEurHIQTjzhtY8sfLHVZCo07vbkWSqjcbGsEUNFBXHYpvuj+94WwIMiCOp voJE1wI0egJRe4pA4B9Io9HR7aMpfjlh03taOzUeC2s3ZfF9rcZG6MzhhimlUmfjR8hl DOD2pxzwwKjyjBHvifQa8q9lJ+qvd/fJziSLw=
DomainKey-Signature a=rsa-sha1; c=nofws; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=APtNInWSqQM+ymu2gM+kq+P3G0NKLIpAKBIwkDE0REqWdGQ4c0tmGqvERi4ZIRJutP xJ2IToNJ71QnNkM0ap7tD+7vpWOv5NFnuw8oSptaE0PV1OS/OTbaEybCfSznAeYPmpgt Awce7cPRL3KBfuAONH+bwzUfruR0fTPqf0hbk=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <d423a455-f14e-4cb4-8744-0a49259c9c86@34g2000pru.googlegroups.com>
References <mailman.1226.1304663814.9059.python-list@python.org> <200e93c2-6b87-4113-9c6f-85815e51ea77@28g2000yqu.googlegroups.com> <4dc4b3c5$0$29991$c3e8da3$5496439d@news.astraweb.com> <iuvp98-446.ln1@svn.schaathun.net> <roy-5F8DA7.08265211052011@news.panix.com> <931adaF9g1U1@mid.individual.net> <roy-FC7816.07362712052011@news.panix.com> <4dcc785e$0$29980$c3e8da3$5496439d@news.astraweb.com> <d423a455-f14e-4cb4-8744-0a49259c9c86@34g2000pru.googlegroups.com>
Date Fri, 13 May 2011 01:02:07 -0700
X-Google-Sender-Auth oUl39s0WXnPboXYx7ni44rtWsZw
Subject Re: checking if a list is empty
From Chris Rebert <clp2@rebertia.com>
To rusi <rustompmody@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1509.1305273735.9059.python-list@python.org> (permalink)
Lines 64
NNTP-Posting-Host 82.94.164.166
X-Trace 1305273736 news.xs4all.nl 81474 [::ffff:82.94.164.166]:43571
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5284

Show key headers only | View raw


On Thu, May 12, 2011 at 11:46 PM, rusi <rustompmody@gmail.com> wrote:
<snip>
> The boolean domain is only a 100 years old.
> Unsurprisingly it is not quite 'first-class' yet: See

It is nowadays. Every halfway-mainstream language I can think of has
an explicit boolean datatype. Heck, as of C99, even C has one now. I
conjecture the only languages still lacking one are exotic
niche/fringe languages. I would be interested to see a counterexample.

> http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1070.html
> [Lifted from http://c2.com/cgi/wiki?EqualVsTrueFalse ]
>
> ----------------------------
> "In retrospect, one might be tempted to regard the introduction of
> something as simple as the boolean domain as a minor invention, but I
> think that that would be a grave mistake: it is a great invention
> because, being so simple, it is such a powerful simplifier. It is of
> the same level as the introduction of natural numbers, which enabled
> us to add 3 to 5, regardless of whether we are adding apples or
> pears."
>
> "George Boole made a radical invention, so radical, in fact, that now,
> more than a century later, the scientific community has not absorbed
> it yet. (To stay with the metaphor: officially, boolean expressions
> may have reached the status of first-class citizens, in practice —
> because old habits and prejudices die hard— they are still the victims
> of discrimination.) Let me give you a few examples."
>
> "In the programming language FORTRAN, as conceived a century after
> Boole published his invention, boolean expressions are allowed, but
> there are no boolean variables! Their introduction into programming
> had to wait until the design of ALGOL 60."
>
> ------------------------
> So, M Harris problem is that python could almost be a language for the
> 'masses' (whatever that might mean) were it not for warts like "l not
> is empty" is shorten-able to just "l"

One language's wart is another language's idiom. And I think the
irrational hate towards syntactically-significant indentation is by
far a much larger barrier to "mass" adoption of Python; C++ has some
features that are at least (if not more) subtle/unobvious than
Python's __bool__(), yet it still enjoys "mass" use.

> Dijkstra's problem (paraphrased) is that python, by choosing the
> FORTRAN alternative of having a non-first-class boolean type, hinders
> scientific/mathematical thinking/progress.

Python has *not* chosen the Fortran alternative; *it has a first-class
Boolean type*, namely bool. This line of argument thus fails.
The fact that other types are implicitly coercible to bools doesn't
make `bool` itself any less first-class.

It is also ironic that one of the projects that exploits Python's
flexible typing regarding normally-Boolean operators is a scientific
one (NumPy).

Cheers,
Chris
--
http://rebertia.com

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


Thread

checking if a list is empty Jabba Laci <jabba.laci@gmail.com> - 2011-05-06 02:36 -0400
  Re: checking if a list is empty Richard Thomas <chardster@gmail.com> - 2011-05-06 03:34 -0700
  Re: checking if a list is empty scattered <tooscattered@gmail.com> - 2011-05-06 14:57 -0700
    Re: checking if a list is empty Philip Semanchuk <philip@semanchuk.com> - 2011-05-06 18:21 -0400
    Re: checking if a list is empty Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-06 17:51 -0600
      Re: checking if a list is empty Jon Clements <joncle@googlemail.com> - 2011-05-06 17:43 -0700
        Re: checking if a list is empty Hans Mulder <hansmu@xs4all.nl> - 2011-05-14 10:52 +0200
    Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-07 02:51 +0000
      Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-11 10:02 +0100
        Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-11 12:14 +0000
          Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-11 15:05 +0100
            Re: checking if a list is empty "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-05-11 10:27 -0400
              Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-11 18:59 +0100
                Re: checking if a list is empty alex23 <wuwei23@gmail.com> - 2011-05-11 20:16 -0700
                Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-12 06:20 +0100
            Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-11 15:50 +0000
              Re: checking if a list is empty Chris Angelico <rosuav@gmail.com> - 2011-05-12 02:05 +1000
                Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-11 18:56 +0100
                Re: checking if a list is empty harrismh777 <harrismh777@charter.net> - 2011-05-11 16:13 -0500
          RE: checking if a list is empty "Prasad, Ramit" <ramit.prasad@jpmchase.com> - 2011-05-11 13:39 -0400
        Re: checking if a list is empty Roy Smith <roy@panix.com> - 2011-05-11 08:26 -0400
          Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-11 13:29 +0000
          Re: checking if a list is empty Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-12 17:44 +1200
            Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-12 07:06 +0100
            Re: checking if a list is empty Roy Smith <roy@panix.com> - 2011-05-12 07:36 -0400
              Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-13 00:16 +0000
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-12 23:46 -0700
                Re: checking if a list is empty Chris Rebert <clp2@rebertia.com> - 2011-05-13 01:02 -0700
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-13 03:58 -0700
                Re: checking if a list is empty Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-14 14:34 +1200
                Re: checking if a list is empty David Robinow <drobinow@gmail.com> - 2011-05-14 10:28 -0400
                Re: checking if a list is empty Roy Smith <roy@panix.com> - 2011-05-14 11:04 -0400
                Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-14 07:39 +0000
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-14 00:45 -0700
                Re: checking if a list is empty Chris Angelico <rosuav@gmail.com> - 2011-05-14 23:42 +1000
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-14 08:47 -0700
                Re: checking if a list is empty Chris Angelico <rosuav@gmail.com> - 2011-05-15 01:55 +1000
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-14 10:43 -0700
                Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-14 17:29 -0400
                Re: checking if a list is empty Ben Finney <ben+python@benfinney.id.au> - 2011-05-15 09:26 +1000
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-14 19:41 -0700
                Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-15 05:07 +0000
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-15 10:33 -0700
                Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-15 17:36 -0400
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-15 22:56 -0700
                Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-16 00:36 +0000
                Re: checking if a list is empty harrismh777 <harrismh777@charter.net> - 2011-05-15 20:59 -0500
                Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-15 22:40 -0700
                Re: checking if a list is empty harrismh777 <harrismh777@charter.net> - 2011-05-15 20:25 -0500
                Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-15 21:57 -0400
                Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-14 16:59 -0400
                Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-15 05:00 +0000
                Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-14 16:53 -0400
          Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-12 15:37 -0400
          Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-12 18:00 -0400
  Re: checking if a list is empty Raymond Hettinger <python@rcn.com> - 2011-05-06 15:52 -0700

csiph-web