[Python-3000] Implementing Abstract Interface for Numbers

Thomas Wouters thomas at python.org
Thu Sep 20 20:03:53 CEST 2007


On 9/19/07, Rob Crowther <weilawei at gmail.com> wrote:
>
> This is the documentation for PyNumberMethods right now.
>
> PyNumberMethods *tp_as_number;
> XXX
>
>
> I've managed to wrap GNU MP floats and add rich comparisons, but there's a
> sore lack of documentation on how to implement the Number interface. Given a
> bit of pointers on where to look, an alpha version of this extension will be
> available tomorrow, most likely.


I'm not sure where you saw that 'XXX' -- are you looking at Py3k docs? In
that case, don't bother, the Numbers API has hardly changed, just use the
Python 2.5 docs. Or the Python 2.0 docs, as there's little difference ;)

But it's true there isn't all that much documentation on those parts. The
PyNumberMethods struct is really straightforward, you should be able to
guess what each function is supposed to do just by looking at the function
signature and the name. But when in doubt, the best place to go is the
Python source. Just look at Objects/intobject.c or Objects/longobject.c.

-- 
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20070920/8ef58daa/attachment.htm 


More information about the Python-3000 mailing list