[C++-sig] Re: Boost.Python: few thoughts and questions... [PATCH]

Roman Sulzhyk roman_sulzhyk at yahoo.com
Sat Jun 14 00:55:30 CEST 2003


--- Nicodemus <nicodemus at globalite.com.br> wrote:
> Roman Sulzhyk wrote:
> 
> >Guys:
> >
> >Anyway, here's a patch with some rather raw hacks so far, if this
> >functionality is useful to Nicodemus I can definitely clean this up.
> >The patch is against stock 1.3.0 pyste.
> >  
> >
> 
> Looks great, thanks a lot Roman! I will apply the patch as soon as I
> can.

Just make sure to clean it up, it's a bit raw. I do think however that
it's probably worthwhile to change pyste internally to treat base
classes similarly to regular classes, because if you start exposing all
of the base classes member functions / member variables implicitely you
would have to change the way 'IsUnique()', 'members', and some other
things are handled... 

> 
> >1) Is it worthwhile to add a 'default reference policy' to pyste,
> i.e.
> >a default conversion (like copy_const_reference) which will be used
> in
> >case one isn't specified explicitely. This will be useful for
> >situations where one has an API which returns a bunch of const
> >std::string &, to avoid having to specify them function by function.
> >
> 
> No, there isn't. But Pyste automatically uses copy_const_reference if
> a 
> member function returns something by constant reference... try using
> the 
> latest CVS.

Cool, that's great.

> >2) How about adding 'converter' functionality to pyste, i.e. ability
> to
> >register default converters using to_python_converter<> ?
> >
> 
> That is indeed something that is missing. For pyste it is simple, we 
> just need to provide a function to the user that inserts the specific
> 
> code into the BOOST_PYTHON_MODULE:
> 
> Include("my_converters.h")
> to_python_converter("converters::vector_to_list", "PyListType")
> 
> Would generate:
> 
> #include <my_converters.h>
> 
> BOOST_PYTHON_MODULE(...)
> {
>     to_python_converter<converters::vector_to_list, PyListType>(); //
> 
> from the top of my head
>     ...
> }
> 
> Something like this would do?

Yep, something like this will do great.  

> Regards,
> Nicodemus.
> 
> 
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig

Thanks!

Roman

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com




More information about the Cplusplus-sig mailing list