On Fri, Dec 10, 2010 at 03:13, Nils Becker <[email protected]> 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, but not for this
reason. The correct idiom to use is this:

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

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to