Nick Coghlan added the comment:

I've also come to agree with Raymond that the repr may not be the best place 
for this additional information, and have updated the issue title accordingly.

For example, as one possible alternative, we might be able to put something in 
the inspect module (e.g. "inspect.callable_info()") that's a higher level 
alternative to "dis.code_info()".

The information displayed could potentially include:

- the object's repr
- the str() of the callable's signature (presented with the name or qualname if 
it has one)
- the names and current repr of any captured closure variables

More controversially, it might include an inferred return type annotation when 
there's no explicit annotation to display (defaulting to "typing.Any", but 
potentially more explicit if it's possible to tell from the code object flags 
that calling it will return a Coroutine or Generator)

----------
title: Expose closure & generator status in function repr() -> Better expose 
closure, generator & coroutine status of functions

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24056>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to