In [31]: all is numpy.all
Out[31]: True
Excellent detective work, Mark! But it still is unexpected, at least to me.
Agreed that it's a bit surprising. It's a consequence of NumPy's
general mechanisms for converting arbitrary inputs to arrays:
from numpy import asarray
asarray([i > 0 for i in range(10)])
array([False, True, True, True, True, True, True, True, True,
True], dtype=bool)array(<generator object <genexpr> at 0x4688aa8>, dtype=object)
So in the second case you get a 0-dimensional array of type 'object',
whose only element is that generator object; not surprisingly, the
generator object is considered true.
As to why it's this way: best to ask on the NumPy mailing lists.
It's probably something that's quite difficult to change without
breaking lots of code, though.