[issue6678] inspect.currentframe documentation omits optional depth parameter
New submission from William Mill : help(inspect.currentframe) reads: - _getframe(...) _getframe([depth]) -> frameobject Return a frame object from the call stack. If optional integer depth is given, return the frame object that many calls below the top of the stack. If that is deeper than the call stack, ValueError is raised. The default for depth is zero, returning the frame at the top of the call stack. This function should be used for internal and specialized purposes only. --- The python library documentation, however, doesn't mention the optional depth parameter: --- inspect.currentframe() Return the frame object for the caller’s stack frame. --- I think substituting the help() text for the library documentation's text would be an improvement. -- assignee: georg.brandl components: Documentation messages: 91459 nosy: georg.brandl, llimllib severity: normal status: open title: inspect.currentframe documentation omits optional depth parameter type: feature request versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2 ___ Python tracker <http://bugs.python.org/issue6678> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6678] inspect.currentframe documentation omits optional depth parameter
William Mill added the comment: This patch is built against trunk, because I'm not sure what branch I should build it against. If that's the wrong branch, I'd be happy to figure it out against the right branch. I tested both the help() and the doc build, both worked as expected. I will happily do anything more I can to help. -- Added file: http://bugs.python.org/file18443/currentframe.diff ___ Python tracker <http://bugs.python.org/issue6678> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6678] inspect.currentframe documentation omits optional depth parameter
William Mill added the comment: I've updated the patch to be based on the py3k branch, and updated the sys module's documentation for _getframe, since inspect just aliases sys._getframe to currentframe(). I've updated the argument list of both inspect.currentframe and sys._getframe to reflect that depth isn't an optional argument, but one with a default value; this matches more closely with the other documentation in those two modules. Also, the function signature is automatically italicized; here's a screenshot of what it looks like: http://img.skitch.com/20100809-xddf43hy2ifxc3b2an4ae85fre.jpg -- Added file: http://bugs.python.org/file18449/currentframe.diff ___ Python tracker <http://bugs.python.org/issue6678> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6678] inspect.currentframe documentation omits optional depth parameter
William Mill added the comment: Terry: fair enough, I'll add that it's required to be an integer. I just meant that the brackets seemed not to be around other keyword arguments, not that it's not optional, sorry for being unclear. Ben and/or Terry: Would you prefer the inspect.currentframe docs to say something like: Returns an alias to :func:`sys._getframe` if it exists, otherwise returns a function which always returns ``None`` ? I see that as more accurate, but perhaps not as useful to a user of the library who then has to go read the documentation for sys._getframe to find out what the function does. -- ___ Python tracker <http://bugs.python.org/issue6678> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com