[Python-Dev] ANN: PEP 335: Overloadable Boolean Operators (original) (raw)

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Sep 15 06:34:46 CEST 2004


"Phillip J. Eby" <pje at telecommunity.com>:

For the numeric use cases, frankly I don't see why one would want to apply short-circuiting boolean operators to arrays, since presumably the values in them have already been evaluated. And if the idea is to make them not be short-circuting operators, that seems to me to corrupt the whole point of the logical operators versus their bitwise counterparts.

There's more to it than short-circuiting. Consider

a = array([42, ""]) b = array([(), "spam"])

One might reasonably expect the result of 'a or b' to be

array([42, "spam"])

which is considerably different from a bitwise operation.

Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+



More information about the Python-Dev mailing list