Hi,

I find the following code snippet, which is useful in my project:


n_iter = 50
sz = (n_iter,) # size of array
x = -0.37727 
z = np.random.normal(x,0.1,size=sz) 

Q = 1e-5 # process variance

# allocate space for arrays
xhat=np.zeros(sz)      
P=np.zeros(sz)         


I learn Python now and the above code seems from an experienced author.
The curious thing to me is the variable 'sz'. I have check np.zeros(shape, ..)

shape : int or sequence of ints


The introduced 'sz' is a tuple. If n_iter function is similar to a constant
in C, I don't see the reason for 'sz'. In fact, 'n_iter' is an int, which fits
the below 

np.zeros(shape)

correctly. Could you see something useful with variable 'sz'?

Thanks,
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to