title: ArrayList in Java vs List in Python
body: <p>Why is ArrayList in Java hashable and List in Python not. It's just based on the choice of the developers or language semantics. </p>
  
  <p>I think Python doesn't allow list to be hashable because it's mutable and hence the hash can change over the lifetime of the object. </p>
  
  <p>It's a good feature or bad feature why does Java allow it. </p>
  
  <pre><code>public class Test {
  
      public static void main(String[] args) {
  
  
          ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
  
          list.add("hello");
  
          System.out.println(list.hashCode());
  
      }
  
  }
  </code></pre>
  
  <p>works fine while below doesn't</p>
  
  <pre><code>&gt;&gt;&gt; l = ["hello"]
  &gt;&gt;&gt; l.__hash__()
  
  Traceback (most recent call last):
    File "&lt;pyshell#103&gt;", line 1, in &lt;module&gt;
      l.__hash__()
  TypeError: 'NoneType' object is not callable
  </code></pre>