Need example for subclassing long in C

Gerhard Häring gerhard.haering at
Sun Sep 29 04:10:02 CEST 2002

I'm trying to add range checks to long and successfully did a Python
implementation. Now I want to translate it to C. Could anybody offer
an example of subclassing a built-in number type at the C level?

Another question I have is how do I do the "long.__add__" call below
at the C-level? I'd like to do it as optimized as possible.
    def __add__(self, other):
        val = long.__add__(self, other)
        PgInt8_checkresult(val, "addition")
        return PgInt8(val)

-- Gerhard

More information about the Python-list mailing list