On Thu, 31 May 2007 12:25:17 -0500, Chris Mellon <[EMAIL PROTECTED]> wrote: > On 31 May 2007 03:45:32 -0700, bullockbefriending bard > <[EMAIL PROTECTED]> wrote: >> Thanks this is good news. I think my C/C++ background is sufficient to >> manage to figure things out if I RTFM carefully. >> >> Basically I want to pass in a Python list of integer tuples, create an >> STL container full of equivalent tuples, apply some processor- >> intensive algorithm to said list of tuples, and finally poke the >> results back into another Python list of integer tuples and return it >> to the calling Python environment. Data structures are well-defind and >> simple, and the most complex case would be 3-deep nested list, so I >> will seriously consider figuring out how to do it manually as you >> suggest. >> > > Are you sure you want an STL container? Since the primary operator > here is Python, the extra benefits from the STL container over plain C > arrays isn't as evident.
STL containers are easier to use, harder to misuse and take care of memory allocations. Wouldn't you say that's a benefit? If I wrote an algorithm in C++, I'd rather pass it a const std::vector<double>& than a const double * and a length. That said, I prefer C for simple extension modules which just wrap something. Less dependencies for the person who builds it, more people who understand it well enough to change it. /Jorgen -- // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu \X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list