[C++-sig] Expression templates in python

David Welch postmaster at ristretto4u.f9.co.uk
Mon Oct 10 16:13:10 CEST 2005


Hi,

I am new to python and thought I would write a vector / matrix class in 
c++ and export to python.

Is it possible to have vector operations done in python evaluate to some 
form of intermediate calculation object which can then be passed to the 
c++ code for evaluation?

ie,
	V1 = [0.1,0.2,0.3]
	V2 = [0.7,0.4,0.7]
	V3 = V1*4 - V2*V1

so the operators in python would not actually do the calulation but 
construct an object which will call a c++ function on assignment to V3 
ala expression templates in c++.

Has this been done before in python, if so is there a link?

Also, is it possible to pass a lambda function as an argument to a c 
function and get information about its contents?

Any advice on how to do this, is it worth it?

Thanks,
Dave




More information about the Cplusplus-sig mailing list