[Python-ideas] Cleaner separation of help() and interactive help.

Ron Adam rrr at ronadam.com
Sat Feb 19 17:36:06 CET 2011



On 02/15/2011 09:18 AM, Nick Coghlan wrote:

> Separating out the string generation from the display process for 3.3.
> may be a reasonable idea, though (similar to the separation of
> dis.code_info() and dis.show_code() in 3.2)


The frustrating part is trying to do this in a way that is acceptable. 
Actually doing it is not that difficult.  I've been working on it by 
chipping away from the outside, but it's going to be a very slow process if 
we need to depreciate each existing API, and then add alternative new API's 
as we go.

Here is a patch on rietveld which includes the items listed below.

http://codereview.appspot.com/4173064


* Remove old web server stuff depreciated in 3.2.  (Will be done in 3.3)

* Separate the topics and topic retrieval parts into a single HelpData 
class with a single method to get the topic text and xrefs list.

We can make this better by making the three dictionaries (keywords, topics, 
and symbols) use the same value formats.  Currently there are slightly 
different ways they each store their value.  It may be possible to have the 
xrefs auto generated and stored along with the topic text.

* Rewrote the helper class by using the cmd.Cmd class.  This works out 
nicely.

After doing this, and a few other things to make it all work, there is only 
a single call to the pager in the Helper.default() method.  It's behavior 
is not changed in any way.  In fact, it could very easily be moved out of 
pydoc and refactored at this point.


But I don't think we can do all of this at one time for backward 
compatibility reasons.(?)  So currently I'm looking for guidance on what 
and how I can best go ahead with some parts of this.

Cheers,
    Ron

(Away for most of today. will respond to comments this evening.)











More information about the Python-ideas mailing list