Many newbie questions regarding python
invalid at invalid.invalid
Fri Oct 8 19:13:03 CEST 2010
On 2010-10-08, Grant Edwards <invalid at invalid.invalid> wrote:
> On 2010-10-07, Rog??rio Brito <rbrito at ime.usp.br> wrote:
>> If possible, I would like to simply declare the list and fill it
>> latter in my program, as lazily as possible (this happens notoriously
>> when one is using a technique of programming called dynamic
>> programming where initializing all positions of a table may take too
>> much time in comparison to the filling of the array).
> At first you say you want a list, later you say you want an array.
> They're two different things. Arrays are variable-length and can be
I meant _Lists_ are fixed-length and homogeneous
> If what you really want is a fixed-length, homogeneous array, then
> use an array instead of a list:
Actually, that's not the right link either. I was thinking more of
NumPy arrays, where you can create an arbitrary sized homogeneous
array of a desired type (either uninitialized or filled with zeros or
If you're crunching so many numbers that initializing a list is
a problem, then you probably ought to be using NumPy.
Grant Edwards grant.b.edwards Yow! for ARTIFICIAL
More information about the Python-list