New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add psource, pfile, pinfo2 commands to ipdb. #2559
Conversation
(Previously pinfo actually ran pinfo2...?)
Good work. I'm in two minds about pinfo - consistency with regular IPython sounds good, but perhaps in a debugger you're more interested in the source code. And I never actually type |
I'm fine with consistency and I don't think many people use |
@@ -477,23 +477,51 @@ def do_list(self, arg): | |||
do_l = do_list | |||
|
|||
def do_pdef(self, arg): | |||
"""The debugger interface to magic_pdef""" | |||
"""Print the definition header for any callable object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I've seen it called the 'definition header' before - I'd describe it as the 'definition' or 'signature'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or 'call signature'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer call signature as well. The wording was actually taken from the %pdef
docstring, for consistency:
In [1]: %pdef?
Type: Magic function
String Form:<bound method NamespaceMagics.pdef of <IPython.core.magics.namespace.NamespaceMagics object at 0x2fb7250>>
Namespace: IPython internal
File: /usr/lib/python2.7/dist-packages/IPython/core/magics/namespace.py
Definition: %pdef(self, parameter_s='', namespaces=None)
Docstring:
Print the definition header for any callable object.
If the object is a class, print the constructor information.
Examples
--------
::
In [3]: %pdef urllib.urlopen
urllib.urlopen(url, data=None, proxies=None)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can change both to 'call signature', then. That's actually more accurate:
In [1]: f = lambda x,y: None
In [2]: %pdef f
f(x, y)
Minor wording quibble; otherwise that looks fine to me. |
Agreed, replaced with 'definition header' -> 'call signature'. |
Great, thanks. I'm merging this now. |
Add psource, pfile, pinfo2 commands to ipdb.
Add psource, pfile, pinfo2 commands to ipdb.
In addition, clean up the docstrings (so that
help <command>
returns more useful information).One notable change is in the behavior of
pinfo
. Previouslypinfo object
did the equivalent ofobject??
, i.e. what we'd callpinfo2
. Is it worth "correcting" this behavior for consistency? I'll gladly discard the last commit (886a3ee) to preserve the existing behavior.