Newbie: Truth values (three-valued logic)
delgado at Mathematik.Uni-Bielefeld.DE
Wed Jun 16 06:27:04 EDT 1999
Thanks to everyone for giving hints.
On Wed, 16 Jun 1999, Tim Peters wrote:
> [Olaf Delgado]
> > I am just starting to use python seriously. Currently, I am porting a
> > small class library from C++ to python, which is kind of fun. Everything's
> > much more simple and elegant now.
> Except for C++ <wink>.
Right! C++ looks even more stupid.
> > As far as I know, the logical negation operator can not be overloaded,
> > so I have no chance to change this, right?
> Right. I'd try overloading "~" instead (the unary prefix "complement"
> operator, special method name __invert__):
I'll consider this. It came to my mind, though, that redefining negation
alone will not help. Next time I'll want to redefine 'and' and 'or'. So,
unless python 2 implements three-valued logic <hint, hint :)>, I'll have
to come up with a routine for myself to handle these truth values
> OTOH, overloading sucks when you have to fight the language -- and 90% of
> the time even when you don't <0.9 wink>.
I agree. On the first hand, again, having to use function calls to
evaluate simple expressions increases the risk that I'll just do it the
usual (infix) way when I think it's save.
lisp-would-save-me-from-infix-temptation-ly your's, Olaf
//// Olaf Delgado Friedrichs, Uni Bielefeld, Mathematik
Olaf Postfach 100131 (room: V4-109)
`=' D-33501 Bielefeld, Germany (phone: +49 521 106-4765)
More information about the Python-list