Issue 32469: Generator and coroutine repr could be more helpful (original) (raw)

Issue32469

Created on 2017-12-31 19:53 by pitrou, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 5068 closed tarasmatsyk,2017-12-31 22:13
Messages (3)
msg309302 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-12-31 19:53
Currently, a generator or coroutine's repr looks like this: >>> gen <coroutine object f at 0x7f86c9733790> It could instead be something like: >>> gen <coroutine at 0x7f86c9733790, suspended, file "/home/antoine/cpython/default/Lib/logging/__init__.py", line 123, code getLogger> (replace "suspended" with "running" or "closed" depending on the generator's status -- i.e. gi_running and gi_frame attributes)
msg309315 - (view) Author: Taras Matsyk (tarasmatsyk) * Date: 2017-12-31 22:14
I have added a pull request. Hope it makes sense and I've done everything correctly :) Happy New Year!
msg319280 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-06-11 07:52
Isn't it too verbose? For comparison, the repr of function doesn't contain the file path and the line number. And the hexadecimal address in the middle looks distractive.
History
Date User Action Args
2022-04-11 14:58:56 admin set github: 76650
2018-06-11 07:52:58 serhiy.storchaka set type: enhancementmessages: + components: + Interpreter Coreversions: + Python 3.8, - Python 3.7
2017-12-31 22:14:58 tarasmatsyk set nosy: + tarasmatsykmessages: +
2017-12-31 22:13:14 tarasmatsyk set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest4942>
2017-12-31 19:53:29 pitrou create