News for hackers. Stuff that matters.
Re:W3schools.dev Redirects to Mozilla Developer Network by proaralyst on Friday March 01, 2019 @10:12AM (#19281305)
Python lists are dynamic arrays, not linked lists.
Re:W3schools.dev Redirects to Mozilla Developer Network by umanwizard on Friday March 01, 2019 @10:13AM (#19281319)
Then why does the article incorrectly claim that Python doesn't support arrays?

The whole point of my comment is that I went away from the article still not knowing whether Python has arrays, or not. I can't understand how anyone would defend an article called "X" that doesn't even properly inform you whether X exists

Re:W3schools.dev Redirects to Mozilla Developer Network by deathanatos on Friday March 01, 2019 @10:51AM (#19281721)
The article is not even wrong. That first yellow highlight is … ugh.

If a programmer from another language asks for an array, I'm going to point them at the `list` class in Python.

As some other sub-comments under your original post note, some uses of an array want the actual data to be contiguous. But Python `list`'s values are references to other values, not the direct values themselves. If you're familiar w/ C, it's closer to an array of pointers to objects. That matters for some niche cases. But in basic tutorial? No. And Python has some built-in types to account for some of the niche cases. Sure, that pointer is not free, and the overhead of a Python object is not free, but Python is a high level scripting language, and generally, `list` provides a random-access ordered collection, which is what most people want when they say "array", and the overhead doesn't matter for many things.

Re:W3schools.dev Redirects to Mozilla Developer Network by ben509 on Friday March 01, 2019 @10:48AM (#19281687)
Python's list type is implemented as a dynamic array in CPython. This is not required.

An optimizing Python doing escape analysis could see a list was going to be converted to a set and swap in a set and change the method calls. Or it could see a large number of concatenations and use a linked list as an intermediate form.