
Dec. 1, 2000
7:15 a.m.
"s" == szport <szport@runet.com> writes:
s> Is the following definition faster or not? s> def ones(shape, typecode=\'l\', savespace=0): s> a = zeros( (product(shape),), typecode, savespace) s> a[:] = 1 s> a.shape = shape s> return a This is yet another way to write a[...]=1 manually via a small detour. For small arrays (size 10...1000) it is about twice slower than writing [...] (0.1ms slower per call on my workstation). Rob -- ===== rob@hooft.net http://www.hooft.net/people/rob/ ===== ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== ===== PGPid 0xFA19277D ========================== Use Linux! =========