surprising result all (generator) (bug??)
Tim Chase
python.list at tim.thechases.com
Tue Jan 31 07:49:26 EST 2012
More information about the Python-list mailing list
Tue Jan 31 07:49:26 EST 2012
- Previous message (by thread): surprising result all (generator) (bug??)
- Next message (by thread): surprising result all (generator) (bug??)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): surprising result all (generator) (bug??)
- Next message (by thread): surprising result all (generator) (bug??)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list