FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-86690: pdb: additional documentation on retval by romuald · Pull Request #27612 · python/cpython · GitHub

/ cpython Public

gh-86690: pdb: additional documentation on retval - #27612

Closed
romuald wants to merge 1 commit into
python:mainfrom
romuald:pdb-retval-doc
Closed

gh-86690: pdb: additional documentation on retval#27612
romuald wants to merge 1 commit into
python:mainfrom
romuald:pdb-retval-doc

Conversation

romuald commented Aug 5, 2021
edited by serhiy-storchaka
Loading

Copy link
Copy Markdown
Contributor

Add documentation on retvalstating 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())

https://bugs.python.org/issue42524

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()`)
Comment thread Lib/pdb.py
"""retval
Print the return value for the last return of a function.
Alternatively, the return value can be accessed with the local
variable ``__return__``

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread Lib/test/test_pdb.py
... 'jump 8', # jump over second for loop
... 'return', # return out of function
... 'retval', # display return value
... '__return__', # access the return value

iritkatriel Aug 26, 2021
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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__).

python-cla-bot Bot commented Apr 6, 2025

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 9, 2026
github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 12, 2026
serhiy-storchaka changed the title bpo-42524: pdb: additional documentation on retval gh-86690: pdb: additional documentation on retval Aug 12, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL