[Numpy-discussion] truth value of dtypes

Nils Becker n.becker at amolf.nl
Fri Dec 10 04:13:11 EST 2010


why is

>>> bool(np.dtype(np.float))


I came across this when using this python idiom:

def f(dtype=None):
....if not dtype:
........print 'using default dtype'

If there is no good reason to have a False truth value, I would vote for
making it True since that is what one would expect (no?)

More information about the NumPy-Discussion mailing list