Python Array vs. List

Michael Abe
2 min readAug 19, 2021

When coding, just like anything else in life, a big part of communicating is using the proper vocabulary. Aside from the Method vs Function debate, when it comes to Python the easiest thing to slip up on vernacular-wise is ‘Array’ versus ‘List’. In the other coding languages that I consider myself familiar with (Ruby and JavaScript) an array is multiple items denoted inside square brackets. The examples below are of a basic array.

An array of the numbers 1–4 in Ruby
The same array in JavaScript

If you wanted to make the same container for data in python, it would look almost identical to the Ruby version above(the JavaScript version has the declaration of through ‘const’, ‘let’ or ‘var’) the only difference between the two is that technically in Python the data container is called a list.

The example above is essentially the same thing as the other two versions. A container for the numbers 1, 2, 3, and 4. Similar to the other two languages, the container can be manipulated, and iterated through. The main difference in between them is the term that they go by. In Python, ‘list’ is the correct name that ‘array’ defines in Ruby and JavaScript

--

--