[Python-Dev] Problems with new-style classes and coercion

David Abrahams David Abrahams" <david.abrahams@rcn.com
Mon, 22 Apr 2002 13:44:21 -0500


----- Original Message -----
From: "Guido van Rossum" <guido@python.org>

> New-style classes don't support __coerce__.  It's a long and sad
> story, but basically __coerce__ was a mistake, and I've stopped
> supporting it for new-style classes.

That is actually a huge relief, as far as I'm concerned. Boost.Python's
overloading support should handle heterogeneous operator arguments quite
nicely without any intervening __coerce__.

> This means that the + operator
> doesn't call __coerce__.  For some reason, coerce() still calls it;
> maybe that was a mistake.

Maybe; maybe not. Maybe it would be a good idea to issue a warning when
a new-style class defines __coerce__.

BTW, thanks to everyone for pointing out my version mismatch problem. I
have installed and tested against 2.2.1, but needed to update my paths
to invoke it from the command-line.

-Dave