fl <rxjw...@gmail.com> wrote: >Hi, >I find the following code snippet, which is useful in my project: > ... >correctly. Could you see something useful with variable 'sz'?
So that's example code in "An Introduction to the Kalman Filter" by Greg Welch and Gary Bishop, and no, that construct was unnecessary. As you've figured out, you can use the integer directly. It's the usual problem that people get when they switch from using Octave/Matlab to numpy/scipy/matplotlib. The former are better in an interactive maths-oriented environment, but people then often then switch to Python for more complex algorithms to take advantage of the features of an advanced general-purpose programming language. The problem that people then run into is that although there are equivalents in the Python libraries for most of the Matlab functions, this happens to be an area where the documentation is particularly uneven. "Pylab" is a project that attempted to be a Python equivalent of Matlab, but has now become a depreciated appendix to matplotlib. There have been attempts to restart it as a feature of Ipython, but although it mostly works, the documentation is almost nonexistent. The only way to figure out what it can do is to try it yourself with a lot of trial and error. Anyway, don't be surprised if you see unnecessary elaborations in maths/science Python code because it's what you expect when people are arriving at code that works from reading poor documentation, trial and error, and Googling other peoples code snippets. Just try it yourself and save yourself time rather than asking for hand-holding. -- https://mail.python.org/mailman/listinfo/python-list