[Numpy-discussion] "False" and "True" not singletons?
Robert Kern
robert.kern at gmail.com
Tue Dec 30 16:33:52 EST 2008
On Tue, Dec 30, 2008 at 14:59, Christopher Barker <Chris.Barker at noaa.gov> wrote:
> Hi all,
>
> I've just discovered that "False" is not a singleton:
>
> >>> import numpy as N
>
> >>> f = N.all((1,2,0))
> >>> print f
> False
> >>> id(f)
> 17316364
> >>> f is False
> False
> >>> id(False)
> 3294768
>
>
> Should it be?
Well, True and False are singletons, but numpy.any() and numpy.all()
don't return bools. They return numpy.bool_s.
--
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
More information about the NumPy-Discussion
mailing list