DEV Community

Discussion on: Don't use Python List Everywhere

Collapse
 
mellen profile image
Matt Ellen • Edited

Intersting piece, especially the performance evaluations.

Just a couple of points:

l = range(100)
Enter fullscreen mode Exit fullscreen mode

This does not create a list, it creates a range object

type(l)
<class 'range'>
Enter fullscreen mode Exit fullscreen mode

Which means you cannot append to l. you need to turn it into a list:

l = list(range(100))
Enter fullscreen mode Exit fullscreen mode

The second point is very minor, but not all python implementations are written in C. IronPython (C#) and Jython (Java) are two that come to mind.