Skip to content
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

Merged
merged 5 commits into from Nov 12, 2012

Conversation

bfroehle
Copy link
Contributor

@bfroehle bfroehle commented Nov 8, 2012

In addition, clean up the docstrings (so that help <command> returns more useful information).

One notable change is in the behavior of pinfo. Previously pinfo object did the equivalent of object??, i.e. what we'd call pinfo2. Is it worth "correcting" this behavior for consistency? I'll gladly discard the last commit (886a3ee) to preserve the existing behavior.

@takluyver
Copy link
Member

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 pinfo obj, I just do obj?, so the consistency argument isn't that strong.

@Carreau
Copy link
Member

Carreau commented Nov 12, 2012

I'm fine with consistency and I don't think many people use pinfo either.
Merging in a day if no objections.

@@ -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.
Copy link
Member

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'.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or 'call signature'

Copy link
Contributor Author

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)

Copy link
Member

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)

@takluyver
Copy link
Member

Minor wording quibble; otherwise that looks fine to me.

@bfroehle
Copy link
Contributor Author

Agreed, replaced with 'definition header' -> 'call signature'.

@takluyver
Copy link
Member

Great, thanks. I'm merging this now.

takluyver added a commit that referenced this pull request Nov 12, 2012
Add psource, pfile, pinfo2 commands to ipdb.
@takluyver takluyver merged commit 04a71d3 into ipython:master Nov 12, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Add psource, pfile, pinfo2 commands to ipdb.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants