The biggest problem with Python?

Python is a nice language whose biggest caveat may be its lack of speed. But there is a larger problem, and it has to do with the lack of natural arrays.

So technically, arrays are lists in Python. Same deal, different term. Kind of.

Python does not have a built-in array datatype – a Python list is an array of pointers to Python objects, a Numpy array is an array of uniform values. Also, 2D “arrays”, or lists in Python simply don’t work well. For example to create a list with 100 elements and set them to zero involves:

x = []
for i in range(0,100):

To create a 2D list involves putting a list in a list item – similar to the concept of an array-of-arrays.

img = []
for i in range(0,100):
    x = []
    for j in range(0,100):

Now accessing an element can be done using img[i][j]. This is just sheer nastiness, and the main reason to use Numpy arrays. The other reason is – efficiency. Because there are no intrinsic arrays in Python, is it more challenging to deal with data that relies on arrays.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.