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


Groups > comp.lang.python > #19638 > unrolled thread

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

Started byTim Chase <python.list@tim.thechases.com>
First post2012-01-31 06:49 -0600
Last post2012-01-31 06:49 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#19638 — Re: surprising result all (generator) (bug??)

FromTim Chase <python.list@tim.thechases.com>
Date2012-01-31 06:49 -0600
SubjectRe: surprising result all (generator) (bug??)
Message-ID<mailman.5244.1328018664.27778.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web