[Tutor] Write array to Status text

Vicki Stanfield vicki at thepenguin.org
Mon Nov 17 22:06:05 EST 2003


>
>
> On Mon, 17 Nov 2003, Stanfield, Vicki {D167~Indianapolis} wrote:
>
>> I don't know if this made it to the list or not. Here is the code that I
>> tried. It doesn't work correctly. The new values don't get appended to
>> the array.
>
> Hi Vicki,
>
>
> Sorry for abruptly jumping in, but I'm getting the feeling we shouldn't be
> using the 'array' module here.
>
>
> A Python 'List' is a collection that can dynamically grow in size, and
> that's probably what you want to use for general use.  We can construct
> lists by using '[]'.
>
>
> An 'array' is meant to be a statically-sized homogenous collection of
> primitive objects --- like numbers --- and it has a very very specialized
> purpose that most folks won't need to touch.  I guess I'm trying to say
> politely: don't use them now!  *grin*

Funny thing though, my application is just that. There are exactly 4
entries and all are hexadecimal values. The 10 in my array initialization
was just to make sure I didn't exceed my array boundaries. I changed it to
4 later. It is a far more comfortable thing for me since I used them in C,
and it allows me the convenience of the tostring functionality.

But having said that, I will use either if I can make the StatusText thing
work. It is such a minimal part of the project that I really don't care
which I use. It seems really klunky to have to do a join each time I add a
value to my array (list), but if that is what it takes, I'll do it.

--vicki



More information about the Tutor mailing list