[Numpy-discussion] truth value of dtypes
Fri Dec 10 08:33:40 CST 2010
On Fri, Dec 10, 2010 at 03:13, Nils Becker <firstname.lastname@example.org> 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