Possible Duplicate:
Python List vs. Array - when to use?
I'm working on a few projects in Python, and I have a few questions:
- What's the difference between Arrays and Lists?
- If it's not obvious from question 1, which should I use?
- How do you use the preferred one? (create array/list, add item, remove item, pick random item)
Nothing really concrete here and this answer is a bit subjective...
In general, I feel you should use a list just because it is supported in the syntax and is used more widely in the other libraries, etc.
You should use arrays if you know that everything in the "list" will be of the same type and you want to store the data more compactly.
Use lists unless you want some very specific features that are in the C array libraries.
python really has three primitive data structures
More on data structures here: http://docs.python.org/tutorial/datastructures.html