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


Groups > comp.lang.python > #19638

Re: surprising result all (generator) (bug??)

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!amsnews11.chello.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.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.01; 'subject:bug': 0.04; 'unexpected': 0.07; 'python': 0.08; 'behavior:': 0.09; 'cc:addr:python-list': 0.15; 'examples': 0.15; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '-tkc': 0.16; '[gcc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'linux2': 0.16; 'message-id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'subject:result': 0.16; 'xrange': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'cc:no real name:2**0': 0.21; "aren't": 0.21; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'suspect': 0.24; 'cc:2**0': 0.25; 'cc:addr:python.org': 0.29; 'version': 0.31; 'header:User- Agent:1': 0.33; 'something': 0.35; 'unless': 0.37; 'subject: (': 0.39; 'subject:: ': 0.39; 'type': 0.60; 'more': 0.61; 'your': 0.61; 'bitten': 0.84; 'correctly?': 0.84
Date Tue, 31 Jan 2012 06:49:26 -0600
From Tim Chase <python.list@tim.thechases.com>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16
MIME-Version 1.0
To Neal Becker <ndbecker2@gmail.com>
Subject Re: surprising result all (generator) (bug??)
References <jg8nf2$uh6$1@dough.gmane.org>
In-Reply-To <jg8nf2$uh6$1@dough.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
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.5244.1328018664.27778.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328018664 news.xs4all.nl 6965 [2001:888:2000:d::a6]:60433
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19638

Show key headers only | View raw


On 01/31/12 06:40, Neal Becker wrote:
> I was just bitten by this unexpected behavior:
>
> In [24]: all ([i>  0 for i in xrange (10)])
> Out[24]: False
>
> In [25]: all (i>  0 for i in xrange (10))
> Out[25]: True

You sure you transcribed that correctly?

Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more 
information.
 >>> all([i>0 for i in xrange(10)])
False
 >>> all(iter([i>0 for i in xrange(10)]))
False
 >>> all(i>0 for i in xrange(10))
False


So unless it's something in a newer version of Python, I suspect 
your examples aren't what you typed.

-tkc

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


Thread

Re: surprising result all (generator) (bug??) Tim Chase <python.list@tim.thechases.com> - 2012-01-31 06:49 -0600

csiph-web