[issue42524] [doc] pdb access to return value

2021-08-05 Thread Romuald Brunet


Change by Romuald Brunet :


--
pull_requests: +26106
pull_request: https://github.com/python/cpython/pull/27612

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42524] [doc] pdb access to return value

2021-08-04 Thread Irit Katriel


Irit Katriel  added the comment:

Yes, exactly - to update the doc so that the next person who needs it will 
easily find a way to do it (which was not available to you when you created 
this issue).

The test should assert that what the doc says, so that if someone breaks 
documented functionality we will immediately know.

Your point about accessing __return__ directly from the prompt is interesting - 
sure, if that works just document that and make sure the test fails if we make 
a change that breaks it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42524] [doc] pdb access to return value

2021-08-04 Thread Romuald Brunet


Romuald Brunet  added the comment:

I'm not sure I follow.

You wish to "simply" update the doc? (and not update the retval to allow 
storing it into a varible. I'm OK with that)


But if we choose this, I'm not sure what needs changing in the doctests :-?


Another interrogation: is the use locals() really necessary? I can see that I 
can simply use `__return__` to access the return object.
Is there a reason to access it via locals() inside pdb?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42524] [doc] pdb access to return value

2021-08-03 Thread Irit Katriel


Change by Irit Katriel :


--
Removed message: https://bugs.python.org/msg398854

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42524] [doc] pdb access to return value

2021-08-03 Thread Irit Katriel


Irit Katriel  added the comment:

I just noticed your PR. Would you like to continue working on this?

I think we should update the documentation of retval (in the doc and in the 
function's doctring) to say:

"""
retval
Print the return value for the last return of a function.  Alternatively, the 
return value can be accessed with ``locals()['__return__']``.
"""

Then add unit tests and examples as you did.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42524] [doc] pdb access to return value

2021-08-03 Thread Irit Katriel


Irit Katriel  added the comment:

I just noticed your PR. Would you like to continue working on this?

I think we should update the documentation of retval (in the doc and in the 
functions' doctring) to say:

"""
retval
Print the return value for the last return of a function.  Alternatively, the 
return can be accessed with ``locals()['__return__']``.
"""

Then add unit tests and examples as you did.

--
title: pdb access to return value -> [doc] pdb access to return value
versions: +Python 3.11, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com