bool evaluations of generators vs lists
In : bool([ x for x in range(10) if False ])
In : bool( x for x in range(10) if False )
Why do these two evaluate differently? I was expecting that they would
evaluate the same but the generator would return true *as soon as the
first value is detected*. I'd really expect it to act more like...
for i in g:
So what's going on here? Am I using the wrong function or is this
actually just a bug?
MicroVu IT Department
|All times are GMT. The time now is 11:23 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.