Using C++ and ctypes together: a vast conspiracy? ;)

A. Cavallo a.cavallo at mailsnare.com
Wed Jun 3 10:13:00 EDT 2009


On Wednesday 03 June 2009 14:05:35 Roy Smith wrote:
> In article <mailman.1046.1244023834.8015.python-list at python.org>,
>
>  "A. Cavallo" <a.cavallo at mailsnare.com> wrote:
> > The following is the STL equivalent of:
> >
> > print [ x*2 for range(10) in data if (x%2 == 0) ]
>
> Are you sure about that?  I haven't tested the following code, but I
> believe it is a much more direct match the the behavior of your Python code
> (at least on Python 2.5.1).
>
> #include <iostream>
> int main(int argc, char * argv[])
> {
>     std::cout << "SyntaxError: can't assign to function call";
>     std::cout << endl;
> }

Ahahaha you're right!

print [ x*2 for range(10) in data if (x%2 == 0) ] and it should work just 
fine: I've still left 9 minutes to match what I've spent in order to write the 
C++ version including wandering through the STL docs,  compiling, fix the 
syntax errors, finding the gnu STL hasn't compose1 in the expected header 
file........



Regards,
Antonio

btw.  






More information about the Python-list mailing list