Many newbie questions regarding python

Grant Edwards invalid at invalid.invalid
Fri Oct 8 13:15:57 EDT 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
>> heterogeneous.
>
> 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):
>
>   http://www.scipy.org/Tentative_NumPy_Tutorial#head-d3f8e5fe9b903f3c3b2a5c0dfceb60d71602cf93
>
> 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!!
                              gmail.com            



More information about the Python-list mailing list