[Numpy-discussion] truth value of dtypes
robert.kern at gmail.com
Fri Dec 10 09:33:40 EST 2010
On Fri, Dec 10, 2010 at 03:13, Nils Becker <n.becker at amolf.nl> wrote:
> why is
> 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:
if dtype is None:
print 'using default dtype'
"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
More information about the NumPy-Discussion