On Oct 19, 2011, at 12:41 PM, Mike Graham wrote:
I'm still not seeing the great harm this will have on normal Python programmers who don't wish to overload boolean operators.
It is harmful. The and/or operators are not currently dependent on the underlying objects. They can be compiled and explained simply in terms of if's. They are control flow, not just logic operators. We explain short circuiting once and everybody gets it. But that changes if short-circuiting only happens with certain inputs. It makes it much harder to look at code and know what does. I'm reminded of the effort to make "is" over-loadable. It finally go shot down because it so profoundly messed with people's understanding of identity and because is would not longer be possible to easily reason about code (i.e. it becomes difficult to assure that simple container code is correct without knowing what kind of objects were going to be stored in the container). In a way, the and/or/not overloading suggestion is worse than rich comparisons because even the simplest "a and b" expression would have to be compiled in a profoundly different way (and the related peephole optimizations would not longer be valid). Everyone would pay the price. Raymond