[Python-ideas] [Python-ideos] Dedicated overloadable boolean operators

Stephen J. Turnbull stephen at xemacs.org
Thu Nov 26 02:55:48 EST 2015


Nick Coghlan writes:

 > So elementwise logical operators would presumably be aimed at *data
 > merging* problems - creating a combined matrix where some values are
 > taken from matrix A and others from matrix B, based on the truthiness
 > of those values. I'm not enough of a data analyst to know how
 > common

Well, for the social science data analysis I do, that would be
inappropriate.  Variables from different sources are different
variables, you wouldn't just "or" them into a single column of a data
frame.  You would want your data model to account for the fact that
even if they purport to measure the same factor, they're actually
different indicators.

But for a completely different kind of data, images, that sounds a lot
like (Duff's?) compositing operations.  But those are a lot more
flexible than just "and" and "or": color images are "fuzzy" logic, and
so admit many more logical operations (eg, "clamped sum",
"proportional combination", etc.  I'm not sure how that would fit
here, since Python has only a limited number of operator symbols,
fewer than there are compositing operations IIRC.

Steve





More information about the Python-ideas mailing list