[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> Hello everyone again,</DIV>
<DIV> </DIV>
<DIV> 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. =20
Here is my interpreter session :</DIV>
<DIV> </DIV>
<DIV><FONT size=3D3>>>> import webbrowser</FONT></DIV>
<DIV>>>> dir(webbrowser)<BR>['__builtins__', '__doc__', =
'__file__',=20
'__name__', 'webbrowser']<BR>>>> =
dir(webbrowser.__doc__)<BR>[] ##=20
expected....<BR>>>> =
dir(webbrowser.webbrowser)<BR>['__builtins__',=20
'__doc__', '__file__', '__name__', 'webbrowser']<BR>>>>=20
dir(webbrowser.webbrowser.webbrowser)<BR>['__builtins__', '__doc__', =
'__file__',=20
'__name__', 'webbrowser']<BR>>>>=20
dir(webbrowser.webbrowser.webbrowser.webbrowser.webbrowser)<BR>['__builti=
ns__',=20
'__doc__', '__file__', '__name__', 'webbrowser'] ## yup I'm =
confused=20
:)<BR>>>> dir()<BR>['__builtins__', '__doc__', '__name__', =
'pywin',=20
'webbrowser']<BR>>>> dir(pywin)<BR>['__builtins__', '__doc__',=20
'__file__', '__name__', '__path__', 'debugger', 'framework', 'idle', =
'mfc',=20
'scintilla', 'sys', 'tools']<BR>>>> import time ## I =
thought I'd=20
check if it was normal for modules to do the recursive dir=20
dance...<BR>>>> dir()<BR>['__builtins__', '__doc__', =
'__name__',=20
'pywin', 'time', 'webbrowser'] <BR>>>> =
dir(time)<BR>['__doc__',=20
'__name__', 'accept2dyear', 'altzone', 'asctime', 'clock', 'ctime', =
'daylight',=20
'gmtime', 'localtime', 'mktime', 'sleep', 'strftime', 'time', =
'timezone',=20
'tzname']<BR>>>> dir(time.time)<BR>['__doc__', '__name__',=20
'__self__'] ## nope behaves as expected...<BR>>>> </DIV>
<DIV> </DIV>
<DIV> 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> </DIV>
<DIV> Thanks,</DIV>
<DIV> Glen.</DIV></BODY></HTML>
------=_NextPart_000_0065_01C0BEEF.D3E909A0--