[Numpy-discussion] truth value of dtypes

2010-12-10 Thread Nils Becker
Hi, why is bool(np.dtype(np.float)) False ? 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

Re: [Numpy-discussion] truth value of dtypes

2010-12-10 Thread Robert Kern
On Fri, Dec 10, 2010 at 03:13, Nils Becker n.bec...@amolf.nl wrote: Hi, why is bool(np.dtype(np.float)) False ? I came across this when using this python idiom: def f(dtype=None): if not dtype: print 'using default dtype' The default truth value probably should be True,

Re: [Numpy-discussion] truth value of dtypes

2010-12-10 Thread Alan G Isaac
On 12/10/2010 4:13 AM, Nils Becker wrote: def f(dtype=None): if not dtype: I think you want: if dtype is None: fwiw, Alan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org