On Mon, Jul 26, 2010 at 12:09 PM, Ian Bicking firstname.lastname@example.org wrote: ..
I know overriding "and" and "or" has been discussed some time ago, though I'm not sure what the exact reason is that it never went anywhere.
Indeed. See PEP 335. http://www.python.org/dev/peps/pep-0335/.
I remember it as one of those epic-and-boring comp.lang.python threads ;) One obvious complication is that they are short-circuit operations. That is, "a and b" must evaluate a, figure out if it is false, and if so then it returns a. But "a or b" must evaluate a, figure out if it is TRUE, and if so then returns a. So if there was anything like __and__ and __or__ it would have to simply disable any short-circuiting.
The PEP deals with short-circuiting AFAIK.