What's the difference between True and False in python grammar?
<p>I'm reading <a href="https://docs.python.org/3/reference/grammar.html" rel="nofollow">the python language specification</a> and found there's a <code>None</code>,
<code>True</code>, and <code>False</code> token. I can understand the difference between <code>None</code> and
<code>False</code> since <code>None</code> is not a boolan. But, about <code>True</code> and <code>False</code>, why not
just <code>BOOLEAN</code> there? Is there any case where <code>True</code> and <code>False</code>
behave differently? Or is there any semantical difference?</p>

<p>Note that I'm asking about the difference in grammar not the boolean value which
is obviously different.</p>

<p>This is a formalization of the fact that <code>True</code> and <code>False</code> are special names in python3: you can't assign to them.  </p>

<p>The reason that they aren't BOOLEAN is simply that boolean isn't a <a href="https://docs.python.org/3/library/token.html" rel="nofollow">valid token</a> for the parser.  </p>

<p><em>Note:</em> You will find this detail missing in the python2 grammar, where you <em>can</em> actually assign to the names True and False (...if you want to watch the world burn).  </p>

python