[Python-checkins] CVS: python/nondist/sandbox/doctools onlinehelp.py,1.2,1.3
Paul Prescod
python-dev@python.org
Sat, 22 Jul 2000 12:27:46 -0700
- Previous message: [Python-checkins] CVS: python/dist/src/PC config.c,1.26,1.27 frozen_dllmain.c,1.1,1.2 getpathp.c,1.17,1.18 winsound.c,1.2,1.3
- Next message: [Python-checkins] CVS: python/dist/src/Include ceval.h,2.34,2.35 import.h,2.25,2.26 modsupport.h,2.32,2.33 pgenheaders.h,2.20,2.21 sysmodule.h,2.20,2.21 unicodeobject.h,2.15,2.16
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/nondist/sandbox/doctools
In directory slayer.i.sourceforge.net:/tmp/cvs-serv25027
Modified Files:
onlinehelp.py
Log Message:
Better introspection. (sorry for the checkin flurry)
Index: onlinehelp.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/doctools/onlinehelp.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** onlinehelp.py 2000/07/22 18:51:36 1.2
--- onlinehelp.py 2000/07/22 19:27:43 1.3
***************
*** 70,73 ****
--- 70,74 ----
import re
import textdoc, types
+ import __builtin__
prompt="--more-- (enter for more, q to quit) "
***************
*** 230,233 ****
--- 231,236 ----
return mod
+ hack_const="__paul_prescod_hack_constant__"
+
class Help:
def __init__( self, out, line_length, docdir=None ):
***************
*** 324,328 ****
# try again -- this time in builtins
! glo=__builtins__.__dict__.get( topic, 0 )
if glo:
self.handleObject( glo )
--- 327,331 ----
# try again -- this time in builtins
! glo=__builtin__.__dict__.get( topic, 0 )
if glo:
self.handleObject( glo )
***************
*** 338,349 ****
# try again -- this time as an attribute OF a module
### FIXME/XXX/TODO: this code is not finished yet!
! parts=string.split( topic, "." )
! for i in range( len( parts ), -1, -1 ):
! if i:
! front=string.join( parts[:i], "." )
mod=my_import( front )
if mod:
! self.handleObject( mod )
! return None
sys.stderr.write( "No such topic "+`topic` )
--- 341,361 ----
# try again -- this time as an attribute OF a module
### FIXME/XXX/TODO: this code is not finished yet!
! parts=topic.split( "." )
! for i in range( len( parts )+1, 0, -1 ):
! dot="."
! front=dot.join( parts[:i] )
mod=my_import( front )
if mod:
! rest=parts[i:]
! obj=mod
! while rest: # try a getattr of a getattr of a getattr ...
! first,rest=rest[0],rest[1:]
! obj=getattr( obj, first, hack_const )
! if obj==hack_const: # failed!
! break
!
! if obj!=hack_const: # success!
! self.handleObject( obj )
! return None
sys.stderr.write( "No such topic "+`topic` )
- Previous message: [Python-checkins] CVS: python/dist/src/PC config.c,1.26,1.27 frozen_dllmain.c,1.1,1.2 getpathp.c,1.17,1.18 winsound.c,1.2,1.3
- Next message: [Python-checkins] CVS: python/dist/src/Include ceval.h,2.34,2.35 import.h,2.25,2.26 modsupport.h,2.32,2.33 pgenheaders.h,2.20,2.21 sysmodule.h,2.20,2.21 unicodeobject.h,2.15,2.16
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]