relational/boolean operator overloading

Aahz Maruch aahz at panix.com
Fri Mar 16 12:56:27 EST 2001


In article <98tjq6$qre$1 at news.flashnet.it>,
Renzo Tomaselli <renzo.tomaselli at tecnotp.it> wrote:
>
>        I'm trying to use a subset of Python for querying an object
>database, so that I would like to use a relational operator between a set
>and a const value; this would yield another set. Multiple relations would be
>connected by boolean operators with a meaning of set operators and so on.
>This approach would enable a straight variable binding.
>However there seems no way to redefine such operators, only numeric binary
>operators are mentioned in the ref. manual.
>Any trick/suggestion/comment ?

Not sure what advice to give you with current Python, but Python 2.1
introduces rich comparisons, which may give you what you want.  See
PEP 207, http://python.sourceforge.net/peps/pep-0207.html

Python 2.1 will probably be released in about a month.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het Pythonista   http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Three sins: BJ, B&J, B&J



More information about the Python-list mailing list