I quite often use the combination of pprint and the 'dict' attribute while writing new python code and every now and again I hit the error:
AttributeError: 'dict' object has no attribute '__dict__'
I know what this means, but I can't help wondering why it wasn't added as a convenience just referencing itself.
If we look further at the dict object, it would seem it has been deliberately left out.
a = {}
dir(a)
['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values', 'viewitems', 'viewkeys', 'viewvalues']
I'm sure it was a decision not to include this, I'd like to know why.