Why would a coder stuff things into __dict__
that can't be used for attribute access? For example, in my Plone instance, dir(portal)
includes index_html
, but portal.index_html
raises AttributeError. This is also true for the __class__
attribute of Products.ZCatalog.Catalog.mybrains
. Is there a good reason why dir()
can't be trusted?
Poking around the inspect
module, I see they use object.__dict__['x']
instead of attribute access for this reason and because they do not want to trigger getattr
magic.