boost::python , dispatching in python
Arnaldur Gylfason
arnaldur at ru.is
Wed Jan 9 20:20:34 CET 2002
This is a multi-part message in MIME format.
------_=_NextPart_001_01C19942.B6438D7A
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
> So it looks like PyNumber_Add is the way to go for a + b
>=20
>=20
> That's the wrong conclusion to draw. The check for list[int] is purely
an
> optimization, just like the check for int+int in the first case.
> PyObject_GetItem() is the simple generalized routine that works for
both
> sequence and mapping protocols:
>=20
> There's no conflict, but the procedure you specified wouldn't work.
Just use
> PyObject_GetItem(). Almost every operation with a possible slot
conflict has
> a similar dispatcher, I'll wager.
You're right! Forgot to take a look at PyObject_GetItem.
I understand where you're going now. By calling PyNumber_Add and
PyObject_GetItem, the python implementation already takes care of
sequence/number, sequence/mapping conflicts for us.
By picking the right python dispatcher we're off the hook.(I wish).
Arnaldur
More information about the Cplusplus-sig
mailing list