Many newbie questions regarding python
invalid at invalid.invalid
Fri Oct 8 19:15:57 CEST 2010
On 2010-10-08, Grant Edwards <invalid at invalid.invalid> wrote:
> 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
Damn. I should give up and go golfing.
_Lists_ are variable-length and can be heterogenous.
_Arrays_ are homogenous and sort-of fixed length.
> [...] 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 ones):
> 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! I'm shaving!!
at I'M SHAVING!!
More information about the Python-list