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
References:
• https://docs.python.org/3/tutorial/datastructures.html
• https://docs.python.org/3/faq/design.html#how-are-lists-implemented-in-cpython
• https://wiki.python.org/moin/TimeComplexity
• https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
• https://v8.dev/blog/elements-kinds