[Python-Dev] Reference implementation for PEP 208 (coercion)

M.-A. Lemburg mal@lemburg.com
Wed, 13 Dec 2000 18:38:00 +0100


Guido van Rossum wrote:
> 
> > Neil Schemenauer writes:
> >  > Sourceforge unloads are not working.  The lastest version of the
> >  > patch for PEP 208 is here:
> >  >
> >  >     http://arctrix.com/nas/python/coerce-6.0.diff
> >  >
> >  > Operations on instances now call __coerce__ if it exists.  I
> >  > think the patch is now complete.  Converting other builtin types
> >  > to "new style numbers" can be done with a separate patch.
> >
> > My one concern about this patch is whether the non-commutativity of
> > operators is preserved.  This issue being important for matrix
> > operations (not to be confused with element-wise array operations).
> 
> Yes, this is preserved.  (I'm spending most of my waking hours
> understanding this patch -- it is a true piece of wizardry.)

The fact that coercion didn't allow detection of parameter
order was the initial cause for my try at fixing it back then.
I was confronted with the fact that at C level there was no way
to tell whether the operands were in the order left, right or
right, left -- as a result I used a gross hack in mxDateTime
to still make this work...

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/