title: AttributeError: 'list' object has no attribute 'A' in my python heap sort
body: <pre><code>import random, timeit
  
  class Heap:
      def _init_(self,L=[]):
          self.A=L
      def _str_(self):
          return str(self.A)
      def _len_(self):
          return len(self.A)
  
      def heapify_down(self,k,n):
          while 2*k + 1&lt;n:
              L,R=2*k + 1, 2*k + 2
          if L &lt; n and self.A[L]&gt; self.A[k]:
              m=L
          else:
              m=k
          if R&lt;n and self.A[R] &gt; self.A[m]:
              m=r
          if m != k:
              self.A[k], self.A[m] = self.A[m], self.A[k]
              k=m
          else:
              return
  
      def make_heap(self):
          n = len(self.A)
          for k in range(n-1,-1,-1):
              self.heapify_down(k,n)
  
      def heap_sort(self):
          n = len(self.A)
          for k in range(len(self.A)-1,-1,-1):
              self.A[0], self.A[k] = self.A[k],self.A[0]
              n=n-1
              self.heapify_down(0,n)
  
  n = int(input())
  random.seed()
  A = []
  for i in range(n):
      A.append(random.randint(-1000,1000))
  B = A[:]
  C = A[:]
  print("Heap sort:")
  print("time =", timeit.timeit("heap_sort(C)", globals=globals(), number=1))
  print("  comparisons = {:10d}, swaps = {:10d}\n".format(Hc, Hs))
  </code></pre>
  
  <p>error is coming out like this:</p>
  
  <pre><code>Heap sort:
  Makefile:6: recipe for target 'py3_run' failed
  make: *** [py3_run] Error 1
  Traceback (most recent call last):
    File "Main.out", line 43, in &lt;module&gt;
      print("time =", timeit.timeit("heap_sort(C)", globals=globals(), number=1))
    File "/usr/lib/python3.6/timeit.py", line 233, in timeit
      return Timer(stmt, setup, timer, globals).timeit(number)
    File "/usr/lib/python3.6/timeit.py", line 178, in timeit
      timing = self.inner(it, self.timer)
    File "&lt;timeit-src&gt;", line 6, in inner
    File "Main.out", line 30, in heap_sort
      n = len(self.A)
  AttributeError: 'list' object has no attribute 'A'
  </code></pre>
  
  <p>my first time having this kind of error so I have no idea what to do. On the internet, it says there is sth wrong with 'my list'. But I think my code is not that wrong, so I still couldn't find the where error came from. Can you please help me?</p>