[C++-sig] boost::* standard python conversions

Preston A. Elder prez at neuromancy.net
Sat Feb 12 00:27:41 CET 2005


I wonder, is there any concentrated task to convert parts of boost that
make sense to have appropriate python wrappers?

So far, I've converted boost::format, boost::date_time and
boost:logic::tribool, however I have not seen a standard place where
people who have had to do such conversions could submit them, or where 
previous user's attempts/efforts could be found.

My attempts so far for the aforementioned libraries are at:
http://www.neuromancy.net/viewcvs/Mantra-I/python/boost/?root=mantra

Obviously some parts of boost are woefully unsuited to conversion
attempts, but there are many parts that conversion is quite suitable. 
Even some template classes can be converted if you take the defaults, for
example boost::basic_format<C> has a standard typedef 'format' and
'wformat', which is what I converted, since obviously I could not
translate the templated class itself.

Hope the above helps others, and I hope to hear about other's efforts in
converting boost::* (or other standard stuff such as std::*, or libc
components).

Second, I noticed that there is a std::map<> and std::vector<> indexing
suite, are there any plans for, say, std::list<> or std::set<>?  Or has
anyone done these in the same style as the vector/map ones?

Finally, I saw mention of someone requesting (quite some time ago)
something like implicitly_convertible that allows you to specify a
conversion function. I would like to voice my opinion that this is an
excellent idea.

After all, the current implicitly_convertible eventually just does:
Result v(Source);

Why not add a standard boost::python way to do instead:
Result v(ConversionFunc(Source));

I don't immagine it would be all that difficult to implement, and it would
save a lot of people a LOT of time trying to mess with the somewhat
ungainly syntax of rvalue conversions, etc.

I tried to make this myself once, but ran into problems, mainly because I
did not quite understand what I was doing (this was very early in my
boost::python days :P).

Thanks,

-- 
PreZ :)
Founder. The Neuromancy Society (http://www.neuromancy.net)





More information about the Cplusplus-sig mailing list