[docs] [issue6678] inspect.currentframe documentation omits optional depth parameter

Terry J. Reedy report at bugs.python.org
Mon Aug 9 05:04:00 CEST 2010


Terry J. Reedy <tjreedy at udel.edu> added the comment:

A parameter with a default is very much optional. Makes no sense otherwise. In 3.x docs, the square brackets that were used in 2.x and are still used for optional args without default are left off because they are redundant. So in the example you depict, context is optional with a default of 1, and 'depth=0' is correct and means that is it optional with default 0.

I just realized that I removed the info that depth must me an integer.
>>> inspect.currentframe(0.0)
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    inspect.currentframe(0.0)
TypeError: integer argument expected, got float

Although it seems obvious, it also seems that the context count in the preceding 3 funcs does not have to be an int, at least not always,
>>> inspect.getframeinfo(inspect.currentframe(0), context=1.0)
Traceback(filename='<pyshell#3>', lineno=1, function='<module>', code_context=None, index=None)

which surprised me, so I think we should insert 'an integer ' before 'depth'.

Call the revision currentframe_2.diff. Some reviewers prefer unique names for uploaded files, and I think the current one should be left in case whichever doc person who grabs this prefers it.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6678>
_______________________________________


More information about the docs mailing list