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.
if session.get('username'):
returns True
while
if session['username']:
returns False
.
It seems odd that the get method returns anything when the username is not present. What is the difference between these two?