Re: How to increase the speed of this program?
- From: "John Machin" <sjmachin@xxxxxxxxxxx>
- Date: 28 Nov 2006 10:49:48 -0800
Fredrik Lundh wrote:
John Machin wrote:
I'm extremely agnostic about the spelling :-) IOW I'd be very glad of
any way [pure Python; e.g. maintaining my own version of the array
module doesn't qualify] to simply and rapidly create an array.array
instance with typecode t and number of elements n with each element
initialised to value v (default to be the zero appropriate to the
typecode).
array(t, [v])*n
</F>
Thanks, that's indeed faster than array(t, [v]*n) but what I had in
mind was something like an additional constructor:
array.filledarray(typecode, repeat_value, repeat_count)
which I speculate should be even faster. Looks like I'd better get a
copy of arraymodule.c and start fiddling.
Anyone who could use this? Suggestions on name? Argument order?
Functionality: same as array.array(typecode, [repeat_value]) *
repeat_count. So it would cope with array.filledarray('c', "foo", 10)
I'm presuming an additional constructor would be better than doubling
up on the existing one:
array.array(typecode[, initializer)
and
array.array(typecode[, repeat_value, repeat_count])
Cheers,
John
.
- Follow-Ups:
- Re: How to increase the speed of this program?
- From: Klaas
- Re: How to increase the speed of this program?
- From: Fredrik Lundh
- Re: How to increase the speed of this program?
- References:
- How to increase the speed of this program?
- From: HYRY
- Re: How to increase the speed of this program?
- From: Leo Kislov
- Re: How to increase the speed of this program?
- From: Peter Otten
- Re: How to increase the speed of this program?
- From: Peter Otten
- Re: How to increase the speed of this program?
- From: John Machin
- Re: How to increase the speed of this program?
- From: Fredrik Lundh
- How to increase the speed of this program?
- Prev by Date: Re: pyxpcom
- Next by Date: Re: SPE (Stani's Python Editor) web site?
- Previous by thread: Re: How to increase the speed of this program?
- Next by thread: Re: How to increase the speed of this program?
- Index(es):
Relevant Pages
|