News for hackers. Stuff that matters.
Re:Reasons Python Sucks by aeturnum on Saturday January 14, 2023 @07:25PM (#34385504)
Many of these things are annoying, but I wanna check something....

Lists in python are called lists because they're linked lists right? They are not called arrays because they are a different data structure.

Edit: Well TIL! Thanks everyone.

Re:Reasons Python Sucks by pdonis on Saturday January 14, 2023 @07:32PM (#34385546)
> Lists in python are called lists because they're linked lists right?

No. At the C level in the interpreter they are arrays of object pointers.

> They are not called arrays because they are a different data structure.

No. They're not called arrays because Python uses the name "array" for something else:

https://docs.python.org/3/library/array.html

Re:Reasons Python Sucks by hiq on Saturday January 14, 2023 @07:44PM (#34385607)
How widely are Python arrays used in practice?
Re:Reasons Python Sucks by pdonis on Saturday January 14, 2023 @07:57PM (#34385686)
I haven't had much occasion to use them. I suspect that most use cases nowadays where the speed advantage is needed involve numerical computing where the user is probably using a library like numpy or scipy and will use their array implementation, not the built-in Python one. However, arrays have been around in Python since very early on, when those other numerical libraries didn't exist, so the array built-in might have gotten more use then.
Re:Reasons Python Sucks by lights0123 on Saturday January 14, 2023 @07:30PM (#34385533)
No, lists are implemented in CPython as an regular, contiguous array of PyObject. There is an array library (https://docs.python.org/3/library/array.html) for more efficient storage, comparable to JS's Uint8Array and friends.
Re:Reasons Python Sucks by LightHugger on Saturday January 14, 2023 @07:30PM (#34385534)
lists are arrays with different data types allowed per index
Re:Reasons Python Sucks by raymondh on Saturday January 14, 2023 @07:29PM (#34385530)
Nope.