[IPython-user] WRT %pdef and %pdoc: shortcut proposal - is there any way to get them on some 1 char shortcut?

Tom Popovich tpop.news at gmail.com
Tue Oct 4 14:51:43 CDT 2005


Consider the following:


import re

( you do this first but you are familar with all the details of match)
( then we want to use the %pdef and %pdoc on re.match to look up how to use
it... )
( but pdef and pdoc are a little hard to type.)


How about a new: / (or maybe ?- ) operator that does the ? but throws away
all but the pdef and pdoc parts of the ? output.
thinking ?- means ? with a bunch thrown out as we have ? and ?? and ??? to
give successively more detail.

I'd suggest either:

/ re.match -or-
?- re.match

That would do both %pdef and %pdoc on re.match in our example.
If a combo / action is bad, maybe some new 1 char shortcuts for the
individual %pdef and %pdoc output.
In that case, user could use either of those (to get enter the pdef or pdoc
part he/she wanted)?


What could the combo pdef + pdoc shortcut look like in action, assume its:
/ re.match


for use of / we would disallow trailing slash?
I.e. would we also allow: re.match / Since we can do ? xxx and xxx ?
I suggest that we would allow that form also.


The suggested output would print like this:

In [20]: / re.match
re.match(pattern, string, flags=0) << pdef part

Try to apply the pattern at the start of the string, returning << pdoc part
a match object, or None if no match was found.

In [21]:

The / actions vs the ? (more detailed output ) format:

==========================
In [24]: re.match ?
Type: function
Base Class: <type 'function'>
String Form: <function match at 0x007E7C70>
Namespace: Interactive
File: c:\python23\lib\sre.py
Definition: re.match(pattern, string, flags=0)
Docstring:
Try to apply the pattern at the start of the string, returning
a match object, or None if no match was found.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/ipython-user/attachments/20051004/b2f64074/attachment.html 


More information about the IPython-user mailing list