logo       

Re: registering simple conversions from/to python: msg#00312

python.c++

Subject: Re: registering simple conversions from/to python

"Ralf W. Grosse-Kunstleve" <rwgk@xxxxxxxxx> writes:

> --- Brett Calcott <brett.calcott@xxxxxxxxxxxxxxx> wrote:
>> Wow! I was off on some wild goose chase making things complicated,
>> thinking I had to write custom converters..
>
> Hey, hey, hey... not so fast!
>
> The add_property approach is cute but doesn't scale. Soon you will find that
> you want to add, multiply, divide, etc. using operator overloading and that
> you
> need a whole bunch of other member functions.

Ralf, I think you are assuming a *lot* about what Brett wants to
accomplish. The one example he showed gives me no reason to believe
that he wants to convert whole classes to/from Python tuples. Maybe
he does really want that, and I just missed something... all he *said*
he wanted was:

>>> obj.name_corresponding_to_several_cplusplus_data_members = some_tuple

For which to/from tuple conversions are little or no help.

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise