[Tutor] webbrowser module, weird weird behaviour

Glen Wheeler wheelege@tsn.cc
Fri, 6 Apr 2001 23:18:02 +1000


This is a multi-part message in MIME format.

------=_NextPart_000_0065_01C0BEEF.D3E909A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

  Hello everyone again,

  I thought my anguish was for naught when I was looking through the =
docs and located the module 'webbrowser' however this module appeared to =
do nothing, and in fact had a very strange characteristic...to me at =
least.  Here is my interpreter session :

>>> import webbrowser
>>> dir(webbrowser)
['__builtins__', '__doc__', '__file__', '__name__', 'webbrowser']
>>> dir(webbrowser.__doc__)
[]  ## expected....
>>> dir(webbrowser.webbrowser)
['__builtins__', '__doc__', '__file__', '__name__', 'webbrowser']
>>> dir(webbrowser.webbrowser.webbrowser)
['__builtins__', '__doc__', '__file__', '__name__', 'webbrowser']
>>> dir(webbrowser.webbrowser.webbrowser.webbrowser.webbrowser)
['__builtins__', '__doc__', '__file__', '__name__', 'webbrowser']  ## =
yup I'm confused :)
>>> dir()
['__builtins__', '__doc__', '__name__', 'pywin', 'webbrowser']
>>> dir(pywin)
['__builtins__', '__doc__', '__file__', '__name__', '__path__', =
'debugger', 'framework', 'idle', 'mfc', 'scintilla', 'sys', 'tools']
>>> import time  ## I thought I'd check if it was normal for modules to =
do the recursive dir dance...
>>> dir()
['__builtins__', '__doc__', '__name__', 'pywin', 'time', 'webbrowser'] =20
>>> dir(time)
['__doc__', '__name__', 'accept2dyear', 'altzone', 'asctime', 'clock', =
'ctime', 'daylight', 'gmtime', 'localtime', 'mktime', 'sleep', =
'strftime', 'time', 'timezone', 'tzname']
>>> dir(time.time)
['__doc__', '__name__', '__self__']  ## nope behaves as expected...
>>>=20

  So, well though this doesn't have anything to really do with the =
function of the webbrowser module or how to use it, I think it's still =
curious and worth posting...can anyone plz explain??

  Thanks,
  Glen.

------=_NextPart_000_0065_01C0BEEF.D3E909A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>&nbsp; Hello everyone again,</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; I thought my anguish was for naught when I was looking =
through the=20
docs and located the module 'webbrowser' however this module appeared to =
do=20
nothing, and in fact had a very strange characteristic...to me at =
least.&nbsp;=20
Here is my interpreter session :</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D3>&gt;&gt;&gt; import webbrowser</FONT></DIV>
<DIV>&gt;&gt;&gt; dir(webbrowser)<BR>['__builtins__', '__doc__', =
'__file__',=20
'__name__', 'webbrowser']<BR>&gt;&gt;&gt; =
dir(webbrowser.__doc__)<BR>[]&nbsp; ##=20
expected....<BR>&gt;&gt;&gt; =
dir(webbrowser.webbrowser)<BR>['__builtins__',=20
'__doc__', '__file__', '__name__', 'webbrowser']<BR>&gt;&gt;&gt;=20
dir(webbrowser.webbrowser.webbrowser)<BR>['__builtins__', '__doc__', =
'__file__',=20
'__name__', 'webbrowser']<BR>&gt;&gt;&gt;=20
dir(webbrowser.webbrowser.webbrowser.webbrowser.webbrowser)<BR>['__builti=
ns__',=20
'__doc__', '__file__', '__name__', 'webbrowser']&nbsp; ## yup I'm =
confused=20
:)<BR>&gt;&gt;&gt; dir()<BR>['__builtins__', '__doc__', '__name__', =
'pywin',=20
'webbrowser']<BR>&gt;&gt;&gt; dir(pywin)<BR>['__builtins__', '__doc__',=20
'__file__', '__name__', '__path__', 'debugger', 'framework', 'idle', =
'mfc',=20
'scintilla', 'sys', 'tools']<BR>&gt;&gt;&gt; import time&nbsp; ## I =
thought I'd=20
check if it was normal for modules to do the recursive dir=20
dance...<BR>&gt;&gt;&gt; dir()<BR>['__builtins__', '__doc__', =
'__name__',=20
'pywin', 'time', 'webbrowser']&nbsp; <BR>&gt;&gt;&gt; =
dir(time)<BR>['__doc__',=20
'__name__', 'accept2dyear', 'altzone', 'asctime', 'clock', 'ctime', =
'daylight',=20
'gmtime', 'localtime', 'mktime', 'sleep', 'strftime', 'time', =
'timezone',=20
'tzname']<BR>&gt;&gt;&gt; dir(time.time)<BR>['__doc__', '__name__',=20
'__self__']&nbsp; ## nope behaves as expected...<BR>&gt;&gt;&gt; </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; So, well though this doesn't have anything to really do with =
the=20
function of the webbrowser module or how to use it, I think it's still =
curious=20
and worth posting...can anyone plz explain??</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; Thanks,</DIV>
<DIV>&nbsp; Glen.</DIV></BODY></HTML>

------=_NextPart_000_0065_01C0BEEF.D3E909A0--