Photo by João Vítor Heinrichs from Pexels

Python vs JavaScript: Lists

A simple comparison between Python list and JavaScript Array - mutable sequences of a dynamic size and an unrestricted content type.

Python 3 and a “modern” JS engine are assumed (V8, SpiderMonkey, JavaScriptCore).

Python List vs JS Array

Time complexity of common operations

Amortized worse case complexity

Pitfalls

Common recipes

Alternatives

Python

Tuple, str, bytes - immutable sequences
Bytearray - mutable sequences of bytes
Deque - stack and queue sequences
Array - efficient typed lists
NumPy array - powerful n-dimensional typed arrays from NumPy library

JavaScript

Build-in TypedArrays - mutable sequences of bytes

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response