Consider the following:<br>
<br>
<br>
import re<br>
<br>
( you do this first but you are familar with all the details of match)<br>
( then we want to use the %pdef
and %pdoc on re.match to look up how to use it... )<br>
( but pdef and pdoc are a little hard to type.)<br>
<br>
<br>How about a new: / (or maybe ?- )
operator that does the ? but throws away all but the pdef
and pdoc parts of the ? output.<br>
thinking ?- means ? with a bunch thrown out as we have ? and ?? and ??? to give successively more detail.<br>
<br>
I'd suggest either:<br>
<br>
/ re.match -or-<br>
?- re.match<br>
<br>That would do both %pdef and %pdoc on re.match in our example.<br>
If a combo / action is bad, maybe some new 1
char shortcuts for the individual %pdef and %pdoc output.<br>
In that case, user could use either of those (to get enter the pdef or pdoc part he/she wanted)?<br>
<br>
<br>What could the combo pdef + pdoc shortcut look like in action, assume its:<br>
/ re.match<br>
<br>
<br>
for use of / we would disallow trailing slash?<br>
I.e. would we also allow: re.match
/ Since we can do ?
xxx and xxx ?<br>
I suggest that we would allow that form also.<br>
<br>
<br>
The suggested output would print like this:<br>
<br>
In [20]: / re.match<br>
re.match(pattern, string, flags=0)
<< pdef part<br>
<br>
Try to apply the pattern at the start of the string, returning << pdoc part<br>
a match object, or None if no match was found.<br><br>
In [21]: <br>
<br>
The / actions vs the ? (more detailed output ) format:<br>
<br>
==========================<br>
In [24]: re.match ?<br>
Type: function<br>
Base Class: <type 'function'><br>
String Form: <function match at 0x007E7C70><br>
Namespace: Interactive<br>
File: c:\python23\lib\sre.py<br>
Definition: re.match(pattern, string, flags=0)<br>
Docstring:<br>
Try to apply the pattern at the start of the string, returning<br>
a match object, or None if no match was found.<br>
<br>