a=[ lambda t: t**n for n in range(4) ]

mehmetmutigozel at gmail.com mehmetmutigozel at gmail.com
Fri Apr 22 20:17:36 EDT 2005


Thanx.

It just popped in my mind.

in 3d programming there are transformation matrices like
a=[[cos(x),sin(x),0],[-sin(x),cos(x),0],[0,0,1]]
it is a 3x3 matrix. never changes during program.

it can be defined like
>>> def transmat(x):
...           dummy=[[0,0,0],[0,0,0],[0,0,0]]
...           dummy[0][0]=cos(x)
...           ~~~~~~
...           return dummy

a=transmat(1.0)

it is usual way for this.

i wonder if there is an automatic way to make that without calling a
function.

an automatic way that depends on changing the value of x. as each time
x=something used the whole matrix changes automaticly.

or maybe i am just dreaming. :)




More information about the Python-list mailing list