[Python-Dev] Problems with new-style classes and coercion (original) (raw)

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