diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-02-25 20:55:47 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-02-25 20:55:47 (GMT) |
commit | 221085de89afa861c49ff4306979dbbad949d393 (patch) | |
tree | 3e79f6c14311cba733d5f8d1a1e2c227d238fd51 /Lib/inspect.py | |
parent | 27d517b21b67b54637acd19785f7adfc38fbd8c2 (diff) | |
download | cpython-221085de89afa861c49ff4306979dbbad949d393.zip cpython-221085de89afa861c49ff4306979dbbad949d393.tar.gz cpython-221085de89afa861c49ff4306979dbbad949d393.tar.bz2 |
Change all the function attributes from func_* -> __*__. This gets rid
of func_name, func_dict and func_doc as they already exist as __name__,
__dict__ and __doc__.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 986a415..e87d3e2 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2,7 +2,7 @@ """Get useful information from live Python objects. This module encapsulates the interface provided by the internal special -attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion. +attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion. It also provides some help for examining source code and class layout. Here are some of the useful functions provided by this module: @@ -129,11 +129,11 @@ def isfunction(object): Function objects provide these attributes: __doc__ documentation string __name__ name with which this function was defined - func_code code object containing compiled function bytecode - func_defaults tuple of any default values for arguments - func_doc (same as __doc__) - func_globals global namespace in which this function was defined - func_name (same as __name__)""" + __code__ code object containing compiled function bytecode + __defaults__ tuple of any default values for arguments + __globals__ global namespace in which this function was defined + __annotations__ dict of parameter annotations + __kwdefaults__ dict of keyword only parameters with defaults""" return isinstance(object, types.FunctionType) def istraceback(object): @@ -353,7 +353,7 @@ def getfile(object): if ismethod(object): object = object.im_func if isfunction(object): - object = object.func_code + object = object.__code__ if istraceback(object): object = object.tb_frame if isframe(object): @@ -496,7 +496,7 @@ def findsource(object): if ismethod(object): object = object.im_func if isfunction(object): - object = object.func_code + object = object.__code__ if istraceback(object): object = object.tb_frame if isframe(object): @@ -741,8 +741,8 @@ def getargspec(func): func = func.im_func if not isfunction(func): raise TypeError('arg is not a Python function') - args, varargs, varkw = getargs(func.func_code) - return args, varargs, varkw, func.func_defaults + args, varargs, varkw = getargs(func.__code__) + return args, varargs, varkw, func.__defaults__ def getargvalues(frame): """Get information about arguments passed into a particular frame. |