[C++-sig] Re: deriving basic python type

David Abrahams dave at boost-consulting.com
Tue Aug 5 14:57:55 CEST 2003


"Alex" <alex at glumol.com> writes:

> Hi 
> In python I can do this : 
>
> class my_int(int):
>  def __rshift__(self, a):    #changing the >> operator behavior for example... 
>         return self + a
>
> The example is quite stupid but is there a way I can make such a
> class in C++(a class deriving the python int or other python types)
> then exporting it in python ?

There's no *easy* way right now, but it's a fairly easy mod to the
Boost.Python sources.  Gottfried Ganßauge has been working on a patch
for another purpose which should make it possible.  Gottfried, how's
it coming along?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list