bpo-42524: pdb: additional documentation on retval#27612
Open
romuald wants to merge 1 commit intopython:mainfrom
Open
bpo-42524: pdb: additional documentation on retval#27612romuald wants to merge 1 commit intopython:mainfrom
romuald wants to merge 1 commit intopython:mainfrom
Conversation
Add documentation on `retval`stating that the return value itself can be accessed via the `__return__` local variable. This is intended to let people know that they can access complex objects using this variable (for example access `__return__.thingy()`)
iritkatriel
reviewed
Aug 5, 2021
| """retval | ||
| Print the return value for the last return of a function. | ||
| Alternatively, the return value can be accessed with the local | ||
| variable ``__return__`` |
Member
There was a problem hiding this comment.
Actually this sentence fits better in the documentation here: https://docs.python.org/3/library/pdb.html#pdbcommand-retval
For the docstring it's not really appropriate to point to an alternative.
iritkatriel
reviewed
Aug 26, 2021
| ... 'jump 8', # jump over second for loop | ||
| ... 'return', # return out of function | ||
| ... 'retval', # display return value | ||
| ... '__return__', # access the return value |
Member
There was a problem hiding this comment.
Because the function returns a string, this test doesn't really check that __return__ is the value rather than the string representation of the value. It also doesn't check that you can assign it to a local and inspect it (in other words - the test doesn't show that there is a difference between retval and __return__).
|
The following commit authors need to sign the Contributor License Agreement: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add documentation on
retvalstating that the return value itself can beaccessed via the
__return__local variable.This is intended to let people know that they can access complex objects
using this variable (for example access
__return__.thingy())https://bugs.python.org/issue42524