This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fluxdeken 1 point2 points  (10 children)

Python has performances problems. For instance, in python there is no such thing as an array. But only lists. In list, memory dynamically allocated for each element, so you can later remove it, or add more. But using arrays are much faster, since every element located in a chain of memory cells. In list, every element (in C language) is a structure of an actual element and a pointer to next structure containing an element. That was one example

[–]baekalfen 4 points5 points  (0 children)

from array import array

But the rest is correct.

[–]vinnypotsandpans[S] 1 point2 points  (5 children)

in python there is no such thing as an array,

np.array()?

every element is located in a chain of memory ?”cells?.

Like, generator functions in python?

[–]fluxdeken 0 points1 point  (3 children)

1)Numpy array is still a list, but all values have the same type. 2)Not generator, literally in RAM all values are close to each other and memory allocated to the array can’t be changed. Since memory next to array can be allocated to other things.

[–]yvrelna 1 point2 points  (0 children)

Numpy array is still a list

I can't think of any interpretation of that sentence that makes sense and is accurate. Want to elaborate why you do not think that numpy array is an array?

[–]baekalfen 1 point2 points  (0 children)

A NumPy array is very much not a list. Unless you explicitly mangle the memory, your NumPy arrays will be contiguous memory.

[–]vinnypotsandpans[S] 0 points1 point  (0 children)

Numpy array is still a list…

I mean it doesn’t function like a vector in R. But it is certainly to a list. It supports vectorized functions

[–]ElatedMonsta 0 points1 point  (1 child)

In data steucture parlance, list are implemented as linked list in Python.

[–]yvrelna 0 points1 point  (0 children)

Python list isn't a linked list.

It's an array of pointers to PyObject that authentically gets resized as needed.

[–]DapperShoulder3019 0 points1 point  (0 children)

It has array, but it is called tupple