environment/lib/python2.7/site-packages/IPython/utils/wildcard.py
def dict_dir(obj):
    """Produce a dictionary of an object's attributes. Builds on dir2 by
    checking that a getattr() call actually succeeds."""
    ns = {}
    for key in dir2(obj):
       # This seemingly unnecessary try/except is actually needed
       # because there is code out there with metaclasses that
       # create 'write only' attributes, where a getattr() call
       # will fail even if the attribute appears listed in the
       # object's dictionary.  Properties can actually do the same
       # thing.  In particular, Traits use this pattern
       try:
           ns[key] = getattr(obj, key)
       except AttributeError:
           pass
    return ns
def dict_dir(obj):
    """Produce a dictionary of an object's attributes. Builds on dir2 by
    checking that a getattr() call actually succeeds."""
    ns = {}
    for key in dir2(obj):
       # This seemingly unnecessary try/except is actually needed
       # because there is code out there with metaclasses that
       # create 'write only' attributes, where a getattr() call
       # will fail even if the attribute appears listed in the
       # object's dictionary.  Properties can actually do the same
       # thing.  In particular, Traits use this pattern
       try:
           ns[key] = getattr(obj, key)
       except AttributeError:
           pass
    return ns
Produce a dictionary of an object's attributes. Builds on dir2 by
    checking that a getattr() call actually succeeds.