Python syntax inconsistency?
<p>I've been reading up on python's <a href="http://www.diveintopython.net/object_oriented_framework/special_class_methods2.html">special class methods</a> in <a href="http://www.diveintopython.net">Dive into Python</a>. And it seems like some methods have odd or inconsistent syntax.</p>

<p>To get the items from a dictionary you would call the dictionary class method items()</p>

<pre><code>&gt;&gt;&gt; my_dictionary.items()
[('name', 'Old Gregg'), ('Race', 'Scaly Man-Fish')]
</code></pre>

<p>However, to determine the number of keys in that dictionary you would call len() and supply it with the dictionary as an argument.</p>

<pre><code>&gt;&gt;&gt; len(my_dictionary)
2
</code></pre>

<p>I always assumed that methods like len() weren't actually part of whatever class you called them on given their syntax but after reading chapter 5 of Dive into Python I see that len() actually does result in a dictionary method being called.</p>

<pre><code>my_dictionary.__len__()
</code></pre>

<p>So why isn't it and methods like it called like a typical class method? </p>

<pre><code>my_dictionary.len()
</code></pre>

<p>Is there a convention I'm unaware of? </p>
