[C++-sig] Derivation from Python str

Hans Meine hans_meine at gmx.net
Wed Sep 29 18:01:43 CEST 2010

Am Mittwoch 29 September 2010, 17:02:57 schrieb Willi Karel:
> I'd like to derive from either Python's built-in 'str' or
> boost::python::str, resulting in a class that provides additional
> methods / member functions / attributes. [...]

AFAIK this is just an unsupported feature of the BPL.  I was (and would still 
be) interested in the same thing, only with list/dict being the base classes, 
but this does not seem to be possible.

From the outside, I would guess/hope that it's not too hard to fix, but having 
looked at various parts of boost::python in the past, I don't think that I 
will try it myself in the near future.

> Including e.g. boost::python::str in the list of base classes yields a
> run-time error in python: [...]

If it was supported, I would say that this would be the right approach/API.

Have a nice day,

More information about the Cplusplus-sig mailing list