Why are some python builtin "functions" actually types?
<p>Many iterator "functions" in the <code>__builtin__</code> module are actually implemented as types, even although the documentation talks about them as being "functions". Take for instance <code>enumerate</code>. The documentation says that it is equivalent to:</p>

<pre><code>def enumerate(sequence, start=0):
    n = start
    for elem in sequence:
        yield n, elem
        n += 1
</code></pre>

<p>Which is exactly as I would have implemented it, of course. However, I ran the following test with the previous definition, and got this:</p>

<pre><code>&gt;&gt;&gt; x = enumerate(range(10))
&gt;&gt;&gt; x
&lt;generator object enumerate at 0x01ED9F08&gt;
</code></pre>

<p>Which is what I expect. However, when using the <code>__builtin__</code> version, I get this:</p>

<pre><code>&gt;&gt;&gt; x = enumerate(range(10))
&gt;&gt;&gt; x
&lt;enumerate object at 0x01EE9EE0&gt;
</code></pre>

<p>From this I infer that it is defined as</p>

<pre><code>class enumerate:
    def __init__(self, sequence, start=0):
        # ....

    def __iter__(self):
        # ...
</code></pre>

<p>Rather than in the <em>standard</em> form the documentation shows. Now I can understand how this works, and how it is equivalent to the <em>standard</em> form, what I want to know is what is the reason to do it this way. Is it more efficient this way? Does it has something to do with these functions being implemented in C (I don't know if they are, but I suspect so)? </p>

<p>I'm using Python 2.7.2, just in case the difference is important.</p>

<p>Thanks in advance.</p>
