Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19638
| Date | 2012-01-31 06:49 -0600 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: surprising result all (generator) (bug??) |
| References | <jg8nf2$uh6$1@dough.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5244.1328018664.27778.python-list@python.org> (permalink) |
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
Re: surprising result all (generator) (bug??) Tim Chase <python.list@tim.thechases.com> - 2012-01-31 06:49 -0600
csiph-web