Flask difference in session.get("variable") and session["variable"]
<p>What is the difference in these two ways to retrieve the session data? I had though they were the same but encountered a difference. When the session variable 'username' is not set the two return different values.</p>

<pre><code>if session.get('username'):
</code></pre>

<p>returns <code> True </code> while </p>

<pre><code>if session['username']:
</code></pre>

<p>returns <code> False </code>. </p>

<p>It seems odd that the get method returns anything when the username is not present. What is the difference between these two?</p>