Photo by Bence Kondor from Pexels

Python object

In Python there are actually two kinds of objects. One — more primitive, is created by calling object() - it returns a new instance of built-in object class. And another - more common - the first one's extension - created by instancing a class. As doc says objects created directly…

Photo by João Vítor Heinrichs from Pexels

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

Photo by Logan Kirschner from Pexels

Are you a full-stack Python developer? Or maybe you know Python and want to learn some differences with JS? Sometimes things are easier to remember when put in comparison, so here is a simple cheatsheet of the implementation of numbers in both languages.

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

Integers

Standard integer (Python int vs JS Number)

Built-in integers with arbitrary precision (Python int vs JS BigInt)

Floats

Python float vs JS Number

Infinity

Not-A-Number

Arithmetic operators

Beniamin Hławiczka

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store