[issue18626] Make python -m inspect name meaningful
Roundup Robot added the comment: New changeset 2e1335245f8f by Nick Coghlan in branch 'default': Close #18626: add a basic CLI for the inspect module http://hg.python.org/cpython/rev/2e1335245f8f -- nosy: +python-dev resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18626 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18626] Make python -m inspect name meaningful
Nick Coghlan added the comment: Thanks for the initial patch Claudiu - I tweaked it a bit before committing it. * as you suggested, displaying the source is the default, with a --details option to display the formatted info instead * changed the displayed details (e.g. only displaying the search path for packages, displaying the line number for classes and functions * a few tweaks to the actual implementation (e.g. using partition over find, avoiding tracebacks for a couple of likely user errors) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18626 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18626] Make python -m inspect name meaningful
Claudiu.Popa added the comment: Hello, here's a basic patch. Currently, the header info is printed by default, while the source can be retrieved by using --source (although I would prefer them to be switched, the source should be shown by default and the header info only when requested). It understands the entry point notation, like 'unittest:util.safe_repr'. -- keywords: +patch nosy: +Claudiu.Popa Added file: http://bugs.python.org/file31799/inspect.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18626 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18626] Make python -m inspect name meaningful
Nick Coghlan added the comment: I realised that with the module:qualname syntax, it's straightforward to expand this beyond module introspection to arbitrary objects. What I suggest we could output: - a header with key module info (names taken from PEP 451): Origin Cached Submodule search path Loader (repr output) - for non-module objects, also include the line within the file (if it can be determined) - the output of getsource() if a --source option is given -- title: Make python -m inspect name dump the source of a module - Make python -m inspect name meaningful ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18626 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com