[Python-Dev] Re: Improving inspect capabilities for classes

2020-06-17 Thread Thomas Viehmann
On 17/06/2020 17:25, Guido van Rossum wrote: I presume Jupyter also lets you import code from a file, which you edit outside, Jupyter? Is,that not an option for you? It's not the file that is the problem, but the lack of it. If I didn't want to cover classes within the __main__ module, I would

[Python-Dev] Re: Improving inspect capabilities for classes

2020-06-17 Thread Thomas Viehmann
On 16/06/2020 20:02, Guido van Rossum wrote: Very few stars. This suggests not many people care about this problem, and that in turn might explain the lukewarm response you find everywhere. This seems to be the core, and combined with the cost of measuring performance impacts of adding a new f

[Python-Dev] Re: Improving inspect capabilities for classes

2020-06-16 Thread Thomas Viehmann
Hello, thank you for your feedback! I could think of a trick that inspect.getsource() might use if the class contains at least one method: it could look at a method and try its `__code__.co_filename` attribute (maybe only if the `__file__` attribute for the module found via the class's `__module

[Python-Dev] Improving inspect capabilities for classes

2020-06-15 Thread Thomas Viehmann
Hello, thank you for making Python and the neat inspect module. I would love to hear your opinion on the following aspect of inspect that I believe might be worth improving: Consider the following program saved in a file (say hello.py): import inspect def hello(): print("Hello World") p