(name, frame, locals)
return None, __UNDEF__
Find the value for a given name in the given environment.
Find the value for a given name in the given environment.
Find the value for a given name in the given environment .
def lookup(name, frame, locals):
    """Find the value for a given name in the given environment."""
    if name in locals:
        return 'local', locals[name]
    if name in frame.f_globals:
        return 'global', frame.f_globals[name]
    if '__builtins__' in frame.f_globals:
        builtins = frame.f_globals['__builtins__']
        if type(builtins) is type({}):
            if name in builtins:
                return 'builtin', builtins[name]
        else:
            if hasattr(builtins, name):
                return 'builtin', getattr(builtins, name)
    return None, __UNDEF__
def lookup ( name , frame , locals ) : if name in locals : return 'local' , locals [ name ] if name in frame . f_globals : return 'global' , frame . f_globals [ name ] if '__builtins__' in frame . f_globals : builtins = frame . f_globals [ '__builtins__' ] if type ( builtins ) is type ( { } ) : if name in builtins : return 'builtin' , builtins [ name ] else : if hasattr ( builtins , name ) : return 'builtin' , getattr ( builtins , name ) return None , __UNDEF__