Python: override len
<p>I have a question about the following method. <code>__len__()</code>. This is rudimentary but I am confused. </p>

<pre><code>class PriorityQueue:

    def __init__(self):
        self.heap = [None]

    def __len__(self):
        print('len is: ', len(self.heap) - 1)
        return len(self.heap) - 1
    def print_len(self):
        print(len(self.heap))

new = PriorityQueue()
</code></pre>

<p>If I use <code>len(new)</code>, then it produces 0, while calling the method <code>print_len()</code> produces 1. </p>

<p>Does this mean that a method inside a class does not use the <code>__len__</code> method(override <code>len()</code>) in the class and use python defined <code>len()</code> function? </p>