(object, predicate=None)
return results
Return all members of an object as (name, value) pairs sorted by name.
    Optionally, only return members that satisfy a given predicate.
Return all members of an object as (name, value) pairs sorted by name.
    Optionally, only return members that satisfy a given predicate.
Return all members of an object as ( name value ) pairs sorted by name . Optionally only return members that satisfy a given predicate .
def getmembers(object, predicate=None):
    """Return all members of an object as (name, value) pairs sorted by name.
    Optionally, only return members that satisfy a given predicate."""
    if isclass(object):
        mro = (object,) + getmro(object)
    else:
        mro = ()
    results = []
    for key in dir(object):
        # First try to get the value via __dict__. Some descriptors don't
        # like calling their __get__ (see bug #1785).
        for base in mro:
            if key in base.__dict__:
                value = base.__dict__[key]
                break
        else:
            try:
                value = getattr(object, key)
            except AttributeError:
                continue
        if not predicate or predicate(value):
            results.append((key, value))
    results.sort()
    return results
def getmembers ( object , predicate = None ) : if isclass ( object ) : mro = ( object , ) + getmro ( object ) else : mro = ( ) results = [ ] for key in dir ( object ) : # First try to get the value via __dict__. Some descriptors don't # like calling their __get__ (see bug #1785). for base in mro : if key in base . __dict__ : value = base . __dict__ [ key ] break else : try : value = getattr ( object , key ) except AttributeError : continue if not predicate or predicate ( value ) : results . append ( ( key , value ) ) results . sort ( ) return results