[Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.54,1.55

Tim Peters tim_one@users.sourceforge.net
2001年10月18日 12:56:19 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv27875/python/Lib
Modified Files:
	pydoc.py 
Log Message:
SF bug [#472347] pydoc and properties.
The GUI-mode code to display properties blew up if the property functions
(get, set, etc) weren't simply methods (or functions).
"The problem" here is really that the generic document() method dispatches
to one of .doc{routine, class, module, other}(), but all of those require
a different(!) number of arguments. Thus document isn't general-purpose
at all: you have to know exactly what kind of thing is it you're going
to document first, in order to pass the correct number of arguments to
.document for it to pass on. As an expedient hack, just tacked "*ignored"
on to the end of the formal argument lists for the .docXXX routines so
that .document's caller doesn't have to know in advance which path
.document is going to take.
Index: pydoc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** pydoc.py	2001年09月27日 04:08:16	1.54
--- pydoc.py	2001年10月18日 19:56:16	1.55
***************
*** 487,491 ****
 return '<dl>\n%s</dl>\n' % result
 
! def docmodule(self, object, name=None, mod=None):
 """Produce HTML documentation for a module object."""
 name = object.__name__ # ignore the passed-in name
--- 487,491 ----
 return '<dl>\n%s</dl>\n' % result
 
! def docmodule(self, object, name=None, mod=None, *ignored):
 """Produce HTML documentation for a module object."""
 name = object.__name__ # ignore the passed-in name
***************
*** 602,606 ****
 return result
 
! def docclass(self, object, name=None, mod=None, funcs={}, classes={}):
 """Produce HTML documentation for a class object."""
 realname = object.__name__
--- 602,607 ----
 return result
 
! def docclass(self, object, name=None, mod=None, funcs={}, classes={},
! *ignored):
 """Produce HTML documentation for a class object."""
 realname = object.__name__
***************
*** 801,805 ****
 return '<dl><dt>%s</dt>%s</dl>\n' % (decl, doc)
 
! def docother(self, object, name=None, mod=None):
 """Produce HTML documentation for a data object."""
 lhs = name and '<strong>%s</strong> = ' % name or ''
--- 802,806 ----
 return '<dl><dt>%s</dt>%s</dl>\n' % (decl, doc)
 
! def docother(self, object, name=None, mod=None, *ignored):
 """Produce HTML documentation for a data object."""
 lhs = name and '<strong>%s</strong> = ' % name or ''

AltStyle によって変換されたページ (->オリジナル) /