[SciPy-dev] Arrays as truth values?
Steven H. Rogers
steve at shrogers.com
Mon Nov 7 07:20:37 CST 2005
Concur that allowing arrays as truth values is the pythonic thing to do.
Please do it as long as it's documented.
Travis Oliphant wrote:
> I agree it can bite people, but I'm concerned that arrays not having a
> truth value is an odd thing in Python --- you have to implement it by
> raising an error when __nonzero__ is called right?
> All other objects in Python have truth values (including its built-in
> array). My attitude is that its just better to teach people the proper
> use of truth values, then to break form with the rest of Python.
> I'm would definitely like to hear more opinions though. It would be
> very easy to simply raise and error when __nonzero__ is called.
> Scipy-dev mailing list
> Scipy-dev at scipy.net
Steven H. Rogers, Ph.D., steve at shrogers.com
"He who refuses to do arithmetic is doomed to talk nonsense."
-- John McCarthy
More information about the Scipy-dev