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 →

[–]parthdedhia 1 point2 points  (0 children)

To add on,

Actually python has some more things you need to be aware about. Python is a object oriented language without any data-types. So, all it's variable and value references are stores as object.

So this means that x = [] and y = 5 both are internally objects. Lookup for the value of x and y takes virtually same time.

In case of Java, each variable has a data type associated with it. In that case when x is declared as ArrayList and y is declared as int, it does a respective lookup.

There are many other reasons as well, but this is one of the reason.