[SciPy-dev] MCMC, Kalman Filtering, AI for SciPy?
Fernando.Perez at colorado.edu
Thu Sep 30 11:42:11 CDT 2004
Perry Greenfield schrieb:
> On Sep 30, 2004, at 3:40 AM, eric jones wrote:
>>I don't like the replication idea very well. I think things should
>>live in one place. Otherwise people will wonder if two functions that
>>are actually the same have different purposes, implementation, etc.
> I agree with this sentiment. Use the search tool to find out where the
> one "true" item lives,
> but don't use aliasing within the package hierarchy.
Fair enough :)
> This seems like a good idea as well. I don't see anything wrong with
> something like:
> import numarray as na
> to make the code (and particularly expressions) more concise. It still
> prevents the above
> mentioned problems.
I've gotten into the habit of always writing:
import Numeric as N
everywhere, and it works quite well. It prevents the problems already
mentioned, and it also allows the following kind of optimization:
dot = N.dot
for i in longlist:
since locals are much faster than globals, if you have some long loop which
repeatedly accesses one of these functions, localizing it may pay off. If
Numeric were imported as *, you'd need to change the local name, since:
dot = dot
More information about the Scipy-dev