Python: is 'int' a type or a function?
<p>I did this in Python 3.4:</p>

<pre><code>&gt;&gt;&gt; type(int)
&lt;class 'type'&gt;
&gt;&gt;&gt; int(0)
0
</code></pre>

<p>Now I am wondering what int actually is. Is it a type, or is it a function? Is it both? If it is both, is it also true that all types can be called like functions?</p>

<p><code>int</code> is a <strong><a href="https://docs.python.org/3.5/tutorial/classes.html">class</a></strong>. The type of a class is usually <code>type</code>.</p>

<p>And yes, <em>almost</em> all classes can be called like functions. You create what's called an <strong>instance</strong> which is an object that behaves as you defined in the class. They can have their own functions and have special attributes.</p>

<p>(<code>type</code> is also a class if you're interested but it's a special class. It's a bit complicated but you can read more on it if you'll search for metaclasses)</p>

python