in Python, are statements objects?
<p>As far as I understand, everything in python is an object or a reference. 
For example: in <code>x = 1</code>, <code>x</code> is a reference to the integer object <code>1</code>. If I write <code>print type(x)</code>, then Python will tell me the object that x is referencing is an integer. </p>

<p>So what about statements such as <code>if</code>?</p>

<p>if I try <code>print type(if)</code>, unsurprisingly, I get a syntax error. I can speculate on why this is the case. Maybe <code>if</code> is a static method of a class, or maybe it has somehow been weirdly defined as non returnable, etc. I just don't know.</p>

<p>Ultimately, I suspect that <code>if</code> has nothing to do with an object or a reference. However, that would surely go against the idea of everything being an object or a reference?    </p>

<p>When they say "everything is an object or a reference" they are referring specifically to data. So this naturally does not apply to statements. Of course, all expressions will result in data. For example <code>a == b</code> is <code>&lt;class 'bool'&gt;</code> because it is an expression.</p>

<p>There are some languages where <code>if</code> is an expression but python is not one of them.</p>

python object if-statement reference conditional