I have an object I'm creating and sometimes it's not going to be created i.e. None.
I perform the following
dic.get("findThis") but since dic is sometimes None It will return AttributeError: 'NoneType' object has no attribute 'get'
There are a few solutions like checking the dic for existence using
if not dic:
print "MISSING"
else:
#do your stuff`.
What's a better way to do this?