[C++-sig] Re: boost.python: problem exposing static attribute with specific to_python converter

Baptiste Lepilleur gaiacrtn at free.fr
Sun Jan 9 21:22:48 CET 2005


----- Original Message ----- 
From: "David Abrahams" <dave at boost-consulting.com>
To: <c++-sig at python.org>
Sent: Saturday, January 08, 2005 5:25 PM
Subject: [C++-sig] Re: boost.python: problem exposing static attribute with
specific to_python converter


> Baptiste Lepilleur wrote:
>
> >     Is this a bug ?
>
> No, just bad instructions from me.  Clearly the docs don't give all the
> information neccessary to get it right or I would have given you good
> instructions :(
>
> >     I got it working using:
> >       .add_static_property( "staticVar",
> >          make_getter(&TestString::staticVar,
> >             return_value_policy<copy_non_const_reference>() ) )
> >
> >     Is there a way to change the return type used in the function
generated
> > by make_getter to be by value instead of by reference, so that the
> > default_call_policies could be used ?
>
> No, but of course you can always make your own getter function that
> returns by value.  It's hard to say which would be preferable.

Well, I'll just enhance pyste to support policy for class attribute as it is
anyway equivalent to making my one getter.

Thanks for helping,
Baptiste.




More information about the Cplusplus-sig mailing list