[email protected]
[Top] [All Lists]

Re: [C++-sig] Expression templates in python

Subject: Re: [C++-sig] Expression templates in python
From: Stefan Seefeld
Date: Mon, 10 Oct 2005 10:52:24 -0400
David Welch wrote:
> 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

Not really, at least not with that straight forward syntax. The reason
is that the 'V1' name above is bound to the object '[0.1,0.2,0.3]',
which has type 'list', i.e. python is 'dynamically typed'.

May be you could play games if 'V1' is an attribute of an object,
for which you overload the 'setattr' method ?

C++-sig mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>