Arrays
Stefan Behnel
stefan_ml at behnel.de
Wed Nov 24 06:18:38 EST 2010
Garland Fulton, 24.11.2010 06:55:
> Is there a way I can define an Array of and unknown size so I can add and
> remove to or from it?
>
> Are arrays immutable?
Python has lists and tuples as basic data structures. Tuples are completely
immutable, lists are completely mutable. If you want a container that has a
fixed size but allows changing items, use a list and avoid calling
.append() and .remove() to change items in favour of direct item
assignments. If you want a completely mutable container, use a list and use
it as you see fit. If you want a stack, a list will do. If you want a
queue, a deque is a better option.
In any case, if you tell us more about what you actually want to do, we can
give better suggestions.
Stefan
More information about the Python-list
mailing list