relational/boolean operator overloading -> PEP 207

Aahz Maruch aahz at panix.com
Tue Mar 20 10:32:51 EST 2001


In article <9977ap$l05$1 at news.flashnet.it>,
Renzo Tomaselli <renzo.tomaselli at tecnotp.it> wrote:
>
>Nevertheless, even when forgetting about my topic for a while, I still
>cannot understand how PEP 207 will handle 'and/or' operators applied to
>"generic" objects which the new relational overloadings could return
>anytime. E.g. how an expression such as "obj1 and obj2" will be evaluated by
>Python 2.1.

This appears to be the appropriate section from the PEP:

    5 In the current proposal, when A<B returns an array of
      elementwise comparisons, this outcome is considered non-Boolean,
      and its interpretation as Boolean by the shortcut operators
      raises an exception.  David Ascher's proposal tries to deal
      with this; I don't think this is worth the additional complexity
      in the code generator.  Instead of A<B<C, you can write
      (A<B)&(B<C).

If you want a better answer, you might try posting to
python-dev at python.org
-- 
                      --- 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

There's a difference between a person who gets shit zie doesn't deserve
and a person who gets more shit than zie deserves.  --Aahz



More information about the Python-list mailing list