Back to the future - python to C++ advice wanted

George Sakkis gsakkis at rutgers.edu
Mon Jun 20 13:37:05 EDT 2005


"Kay Schluehr" wrote:

> I recommend studying C++ idioms carefully.
>
> http://www1.bell-labs.com/user/cope/Patterns/C++Idioms/EuroPLoP98.html

Thanks for the link; very useful indeed.

> If Georges starts on greenfields he may have a look at Qt and it's
> object library which is not only concerned with widgets.
>
> http://doc.trolltech.com/3.3/
>
> BOOST is more high brow and I guess that it compiles slow because it
> uses templates extensively. Template metaprogramming as a compile time
> language was a funny discovery. Here is some prove of it's
> capabilities:
>
> http://osl.iu.edu/~tveldhui/papers/2003/turing.pdf

Many thanks to Kay and Bruno for suggesting Boost; I browsed through
its numerous libraries and they're quite impressive ! They seem
indispensable, especially for python (or other very high level
language) programmers going back to C++. Some libraries that seem to be
very relevant to pythoneers are:

- any: brings dynamic typing in C++
- tuple; 'nuff said
- iterator: out-of-the-box equivalents of
itertools.{imap,ifilter,izip,count}, reversed(), and others not
existing or applicable in python
- tokenizer, string_algo and regex: similar functionality to str.* and
re.*
- bind, mem_fn, function, functional, lambda: first class callables,
currying, higher order (functional) programming
- assign: syntactic sugar through operator overloading for (relatively)
readable container initialization:
    map<int,int> next = map_list_of(1,2)(2,3)(3,4)(4,5)(5,6);
    is actually valid and equivalent to
    next = dict([(1,2), (2,3), (3,4), (4,5), (5,6)])
- many, many more goodies, with or without respective standard python
equivalent (threads, graphs, math utils, serialization,
metaprogramming, etc).
- and last but not least, Boost.Python. I don't think it's just a
coincidence that among all languages they chose Python to make
interoperable with C++ :-)

Thanks again,
George




More information about the Python-list mailing list