DEV Community

Discussion on: Python's Sum or NumPy's np.sum() ???I found a big difference in time!!

Collapse
 
rhymes profile image
rhymes

Python lists are written in C as well: github.com/python/cpython/blob/mas...

The iterator protocol is in C too: github.com/python/cpython/blob/mas...

The sum function, as most builtins, is written in C as well github.com/python/cpython/blob/c00...

;-)

Thread Thread
 
adityaberi8 profile image
Adityaberi

Also i think an array is a collection of homogeneous data-types which are stored in contagious memory locations, on the other hand, a list in Python is collection of heterogeneous data types stored in non-contagious memory locations.