1
00:00:05,440 --> 00:00:09,650
one of the simplest modules in the
Python standard libraries is web browser

2
00:00:09,650 --> 00:00:13,740
which doesn't actually implement a web browser
despite the name but what it does it is allows

3
00:00:13,740 --> 00:00:18,190
you to launch one of your installed
browsers and navigate to a particular url

4
00:00:18,190 --> 00:00:23,280
so this example is going to do just
we are going to launch using your

5
00:00:23,280 --> 00:00:26,870
computers default browser the system's
default browser and navigate to

6
00:00:26,870 --> 00:00:31,910
the python home page so type....
to

7
00:00:31,910 --> 00:00:45,240
import that library and type... and
type in the URL so....

8
00:00:45,240 --> 00:00:52,350
and if I right click that and click on run and by the way I've
created a new project called web

9
00:00:52,350 --> 00:00:58,100
browser and a new Python file called browser.py
so I run browser you can see

10
00:00:58,100 --> 00:01:02,940
it automatically open the browser and the
and the browser opens up Python.org

11
00:01:02,940 --> 00:01:07,380
so you saw previously how the help function can
display a url giving more help on a

12
00:01:07,380 --> 00:01:12,510
module or a function so help itself has
actually as it turns out user's Web

13
00:01:12,510 --> 00:01:16,300
browser to perform that
functionality

14
00:01:16,300 --> 00:01:20,120
because this is such a simple module
provides what we think is a

15
00:01:20,120 --> 00:01:24,180
good example for looking at the
documentation and

16
00:01:24,180 --> 00:01:27,790
learning how to read it so we're not
gonna cover every single module on the

17
00:01:27,790 --> 00:01:31,840
standard library but by the time you
finish this section we should be able to

18
00:01:31,840 --> 00:01:35,690
work out how to use any other modules
that we don't specifically cover by sort

19
00:01:35,690 --> 00:01:39,430
of referring to the documentation so
gonna go to the documentation for web

20
00:01:39,430 --> 00:01:44,550
browser explaining how it is set out and
what are the various terms in the

21
00:01:44,550 --> 00:01:48,010
documentation actually mean now the aim
here again is to provide you with the

22
00:01:48,010 --> 00:01:52,070
knowledge you need to use a
documentation for any other modules so

23
00:01:52,070 --> 00:01:55,840
whether that part of the standard library or for
that matter additional modules that you

24
00:01:55,840 --> 00:02:01,440
may install on your computer and as part
of you will get a general idea of the style and the

25
00:02:01,440 --> 00:02:04,620
level of detail required for useful
documentation and that will help when it

26
00:02:04,620 --> 00:02:08,440
when the time comes to document your own
functions and

27
00:02:08,440 --> 00:02:12,390
modules which is another important aspect
of programming let's go ahead and

28
00:02:12,390 --> 00:02:17,400
just make a modification to our
program we got our web browser opened so what we gonna do

29
00:02:17,400 --> 00:02:23,040
is add another line now we are going to type....
and put web browser in brackets like so

30
00:02:23,040 --> 00:02:26,380
we're gonna run it which will open the
browser and that's navigating you

31
00:02:26,380 --> 00:02:30,130
can see its open another tab in the browser
and that's worked find but if we now tab

32
00:02:30,130 --> 00:02:34,830
back to our program on the
right hand side we actually got some

33
00:02:34,830 --> 00:02:38,030
documentation showing up and that's
what's come up as a result of calling

34
00:02:38,030 --> 00:02:42,930
helped or putting the code line 5 help web browser being name of the standard

35
00:02:42,930 --> 00:02:48,040
library module so getting help web
browser itself provides a link to this

36
00:02:48,040 --> 00:02:53,660
link and I'm going to click on that and copy it rather
and go back to our browser so we can see it in

37
00:02:53,660 --> 00:03:01,130
there its actually going to their you can see the link
is...

38
00:03:01,130 --> 00:03:05,930
....and that can
be slightly different to using a

39
00:03:05,930 --> 00:03:10,490
different version of Python but
let us go through that page anyway and explain any

40
00:03:10,490 --> 00:03:14,070
details that we haven't explained before
that you may not come across before

41
00:03:14,070 --> 00:03:19,240
incidentally if we go back to our code there is the
link that I was talking and this

42
00:03:19,240 --> 00:03:25,070
one is actually 3.5 the other one is 3.4 but it does depend
on the version and you got a good overview of

43
00:03:25,070 --> 00:03:28,170
what this module is all about

44
00:03:28,170 --> 00:03:31,520
obviously interfaces for launching
remotely controlling web browser and

45
00:03:31,520 --> 00:03:36,590
its got the various functions and so on so
go back to the browser and you can see

46
00:03:36,590 --> 00:03:40,540
it's telling us their that it provides a high-level
interface to allow displaying a web

47
00:03:40,540 --> 00:03:44,430
based documents to users and most
circumstances simply calling the open

48
00:03:44,430 --> 00:03:47,670
function which already done from this
module will do the right thing and you

49
00:03:47,670 --> 00:03:52,800
can see that in our case it successfully
worked and when I use the term

50
00:03:52,800 --> 00:03:56,390
high level interface what it is saying is no
need to understand such things as

51
00:03:56,390 --> 00:04:00,580
transport protocols or networking really
your just calling open and everything else

52
00:04:00,580 --> 00:04:04,180
happens magically so that's really
what it is saying in there now this is a

53
00:04:04,180 --> 00:04:08,620
standard way of displaying documentation
for the various modules in Python

54
00:04:08,620 --> 00:04:13,450
and the descriptions generally within
going to describe any special situations

55
00:04:13,450 --> 00:04:17,600
that you should be aware of in other
words any behavior that may vary from

56
00:04:17,600 --> 00:04:21,329
one operating system to the next and also
some usage instructions if the module

57
00:04:21,329 --> 00:04:25,700
can be called in various ways and you can see on
the screen for the web browser module will

58
00:04:25,700 --> 00:04:30,140
warned that the program will block on
UNIX systems if a graphical browser is not

59
00:04:30,140 --> 00:04:34,890
available so that might seem odd but at
one time all browsers were texts base and

60
00:04:34,890 --> 00:04:40,100
I remember myself being introduced to the
internet in 1992 and I

61
00:04:40,100 --> 00:04:44,310
was using a text based browser
and even npw there is still some text base browsers

62
00:04:44,310 --> 00:04:50,170
on linux platforms primarily linux such as links
in which is use fairly heavily

63
00:04:50,170 --> 00:04:53,910
the other thing to note is that some browsers
for people with vision impairment

64
00:04:53,910 --> 00:04:59,220
count as text mode browsers so when it
says the calling process will block the

65
00:04:59,220 --> 00:05:02,980
documentation means that the program
will not continue until the text mode

66
00:05:02,980 --> 00:05:04,690
browser has been closed

67
00:05:04,690 --> 00:05:09,940
obviously in the case of this
application when we ran it , it open the browser for

68
00:05:09,940 --> 00:05:14,320
us automatically but it didn't stop the program
so the program continued on and created

69
00:05:14,320 --> 00:05:21,080
that helped to the right hand side of
code, created this automatically in another words

70
00:05:21,080 --> 00:05:24,810
executed the next line so it didn't
block in other ways in other words so

71
00:05:24,810 --> 00:05:29,240
this documentation in the screen here is
basically to textual representation of

72
00:05:29,240 --> 00:05:33,510
that graphical documentation from
that's in the chrome browser and you can

73
00:05:33,510 --> 00:05:37,530
see it automatically because I'm running
a Mac it loaded that that was my default

74
00:05:37,530 --> 00:05:43,450
browser chrome and that's why use that to
open the url that we gave on line 3

75
00:05:43,450 --> 00:05:47,760
so if a graphical browser is available or the
program's not running under UNIX the program will continue

76
00:05:47,760 --> 00:05:51,820
once the browser has been launched and we saw
that work there if the program had been block though

77
00:05:51,820 --> 00:05:55,450
we wouldn't see the results of calling
help until we close the browser and

78
00:05:55,450 --> 00:05:59,760
clearly the browsers still running when we got it to
work so it's quite important to

79
00:05:59,760 --> 00:06:03,590
understand that and that's the sort of
thing that's generally mentioned

80
00:06:03,590 --> 00:06:06,200
documentation to give you some gotchas
to know that under certain circumstances

81
00:06:06,200 --> 00:06:11,100
specific things may happen and we are gonna
cover this when we look at creating our

82
00:06:11,100 --> 00:06:16,250
own modules but it is possible to create
a .py file that can be executed as a

83
00:06:16,250 --> 00:06:20,750
script and also imported into other
modules now web browser itself that modules

84
00:06:20,750 --> 00:06:24,660
is being written in this way so that the
documentation mentions how it can be

85
00:06:24,660 --> 00:06:31,140
executed as a script from the command
line

86
00:06:31,140 --> 00:06:35,160
you can see there its talking about how
it can be invoked from a command line

87
00:06:35,160 --> 00:06:38,940
and you notice that the line has got a
couple of extra parameters as well and you

88
00:06:38,940 --> 00:06:43,020
notice there is a couple of options on
their -m as a parameter if your calling from the command

89
00:06:43,020 --> 00:06:47,560
line opens the URL in the browser window
if possible and -t

90
00:06:47,560 --> 00:06:51,290
opens the url in a new browser page which is a
tab and obviously can only do one or the

91
00:06:51,290 --> 00:06:54,500
other you can't do both because it is only gonna be only the being new browser window or

92
00:06:54,500 --> 00:06:59,560
a tab the point of all this is that the
documentation is where you go to find this

93
00:06:59,560 --> 00:07:04,440
types of information when you're
dealing with Python modules now there is also

94
00:07:04,440 --> 00:07:09,190
talk there about exceptions as you can see
and we haven't looked at

95
00:07:09,190 --> 00:07:12,560
exceptions yet but they're a really
useful way to handle errors in programs

96
00:07:12,560 --> 00:07:16,750
the note about the exception what they
talk about their with the error that will

97
00:07:16,750 --> 00:07:20,780
make more sense later in the course once
we have been through exceptions so the rest of the

98
00:07:20,780 --> 00:07:24,510
documentation as we scroll down is describing
the various functions available in

99
00:07:24,510 --> 00:07:27,910
details of how to use them the open
function for example you could see there

100
00:07:27,910 --> 00:07:32,150
we got that at the top of the screen there is called
to provide it with the url which will

101
00:07:32,150 --> 00:07:36,370
then attempt to open a window in
which we saw and there is also other versions

102
00:07:36,370 --> 00:07:40,670
of that as well there is other parameters we
can call when we're creating that so again you

103
00:07:40,670 --> 00:07:44,640
can see how it's very useful to go
through a module and find the

104
00:07:44,640 --> 00:07:48,490
documentation for it particularly with
a standard library module that's part of

105
00:07:48,490 --> 00:07:52,340
Python to understand the various
parameters and how to use them and to

106
00:07:52,340 --> 00:07:56,170
see what's available sometimes just going
through the list the documentation

107
00:07:56,170 --> 00:08:00,350
should say for specific a module is really
handy to see different parameters and

108
00:08:00,350 --> 00:08:04,820
again we used the .open but there's
also there's this other options here ....

109
00:08:04,820 --> 00:08:09,100
.....and describing what they're
actually used for as well so we've been using

110
00:08:09,100 --> 00:08:13,300
functions a lot of course the most
common is using print which we have seen

111
00:08:13,300 --> 00:08:17,040
numerous times which just displays the
arguments provided on the screen so this is a

112
00:08:17,040 --> 00:08:20,360
probably a good time now to have a quick
look on arguments parameters in Python's

113
00:08:20,360 --> 00:08:24,700
named parameters so what we would do is to stick to the
print function to define those terms

114
00:08:24,700 --> 00:08:29,410
back to the code editor and I know you have seen
something similar to this and I'll just

115
00:08:29,410 --> 00:08:36,039
closed down this run window as well and we will close this down and comment those out for now we won't use those

116
00:08:36,039 --> 00:08:41,549
will comment out the help line as well so you've seen this before...

117
00:08:41,549 --> 00:08:57,580
and we run that....unsurprisingly the numbers from 0 through 9
but notice as I stop typing

118
00:08:57,580 --> 00:09:06,320
when I was typing now notice there its got objects but its got these other
things on the end of the list as well so

119
00:09:06,320 --> 00:09:10,170
the Asterix before objects that means
that we can provide several objects

120
00:09:10,170 --> 00:09:14,040
separated by commas and we've used this
couple of times in the course so it shows

121
00:09:14,040 --> 00:09:17,000
that we can do things like the following
we could do something like

122
00:09:17,000 --> 00:09:27,010
print.....and noting that they are all
parameters as you can see so we provided nine arguments

123
00:09:27,010 --> 00:09:32,200
and print displays them on a single line so
I won't run that but we know that it does that the values printed are

124
00:09:32,200 --> 00:09:36,330
separated by the character that is provided
for the key word argument which is the

125
00:09:36,330 --> 00:09:42,080
sep which is the second parameters which you can see there
so the default for value for sept is a

126
00:09:42,080 --> 00:09:46,580
space so we didn't specified value and
numbers were separated by spaces so let just

127
00:09:46,580 --> 00:09:53,130
run that actually so that we can see what we are talking about and that
was executed multiple times because I

128
00:09:53,130 --> 00:09:57,760
got a for loop but you can see that there's a
space between each number and that's the

129
00:09:57,760 --> 00:10:03,270
of course the default for that parameter is a space so if you
want to change that what will do is we close

130
00:10:03,270 --> 00:10:09,840
that down and at the end of the list where we
don't want to put anymore parameters we put another comma but we type....

131
00:10:09,840 --> 00:10:17,350
...for separator remember that we brought up the list before....

132
00:10:17,350 --> 00:10:24,780
....and if we run that you can see we got a semi
colon and a space between each number

133
00:10:24,780 --> 00:10:29,590
because we've set the separator is a
semicolon and a space and likewise we

134
00:10:29,590 --> 00:10:36,350
could have got rid of the space, run that and now literally the
numbers are separated only by a

135
00:10:36,350 --> 00:10:41,470
semicolon now print text three more
arguments and we have a look at those again we

136
00:10:41,470 --> 00:10:45,290
can type print...

137
00:10:45,290 --> 00:10:49,070
what we could do here is you can see the other
three parameters file and flush we've

138
00:10:49,070 --> 00:10:54,370
talked about those in section ten when we
were dealing with input output but there is also other

139
00:10:54,370 --> 00:10:59,340
option for end and that's why by default you can see its going to go to a new line /n which

140
00:10:59,340 --> 00:11:05,330
means by default after we have process the line of
output not individual pieces of

141
00:11:05,330 --> 00:11:08,780
information within a print but when it's
finished the entire print statement as to

142
00:11:08,780 --> 00:11:21,680
whether or goes to new line or not we change that to put
for example....and get rid of the second print and run that and you can see now

143
00:11:21,680 --> 00:11:24,400
that we're not going to a new line at
the end of every print is staying just

144
00:11:24,400 --> 00:11:28,870
separating it by space so this is just an example
of the print method and the various

145
00:11:28,870 --> 00:11:33,700
arguments that will actually take so let us just
go back to the web browser documentation

146
00:11:33,700 --> 00:11:39,050
documentation for the functions provided
by the web browser module it really is just showing

147
00:11:39,050 --> 00:11:43,620
the arguments the functions will accept
and then describing what they do so the

148
00:11:43,620 --> 00:11:49,830
open function requires a url which you could
see here and it can also accept two named arguments

149
00:11:49,830 --> 00:11:54,530
new and auto raise which will default to 0 when true
if not specified

150
00:11:54,530 --> 00:11:59,750
back in the code you saw the end had default value of /n in which mean the print

151
00:11:59,750 --> 00:12:03,750
will automatically go to a new line at the
of the print statement by default which if course you can override

152
00:12:03,750 --> 00:12:07,750
so lets try out some of these examples here
of using the open functions so if we go

153
00:12:07,750 --> 00:12:17,460
back to our code I'm gonna comment out that for code and actually what I'll do is just delete it to make it easier and now if we go back and

154
00:12:17,460 --> 00:12:22,640
uncomment the web browser open by
default we can you can see that would

155
00:12:22,640 --> 00:12:29,530
actually set that up to go to the url
but we can put an unnamed parameter...

156
00:12:29,530 --> 00:12:34,120
and run that

157
00:12:34,120 --> 00:12:39,430
now the thing interesting here is don't be
surprised if as in this case even though

158
00:12:39,430 --> 00:12:43,140
we used new equals 1 and we have a look at the documentation again

159
00:12:43,140 --> 00:12:48,470
new=1 a new browser window is open
if possible and new=2 a browser page

160
00:12:48,470 --> 00:12:53,520
tab is opened and in theory you think
that new=1 should open new instance of a browser so

161
00:12:53,520 --> 00:12:57,280
something like this new window that would be
completely new window but it didn't actually

162
00:12:57,280 --> 00:13:01,590
do that so the key words to remember
in this documentation is here if possible

163
00:13:01,590 --> 00:13:05,670
in this case it didn't do it opened it didn't in a
new tab and this does apply to Google

164
00:13:05,670 --> 00:13:10,870
chrome and also to Fire Fox on Ubuntu Linux for
example if you do that all three values

165
00:13:10,870 --> 00:13:15,520
result in your url being opened in a new tab of the
current browser instance as you saw in mac

166
00:13:15,520 --> 00:13:19,220
when I did that as well again the
documentation isn't incorrect it does state that

167
00:13:19,220 --> 00:13:22,790
the behaviors when apply when possible but
moving on let us look at the open_new

168
00:13:22,790 --> 00:13:26,390
this provides the same
functionality specify new=1

169
00:13:26,390 --> 00:13:31,710
and open_new_tab the next
one down provides the same providing the

170
00:13:31,710 --> 00:13:36,160
parameter the parameter new=2 and actual fact each of these functions just

171
00:13:36,160 --> 00:13:41,420
call open with the new set value or new
set sorry with new the named

172
00:13:41,420 --> 00:13:45,550
parameters set to the corresponding
value so far the web browser module has been quite

173
00:13:45,550 --> 00:13:49,180
simple you can open a URL in one of
three ways either by passing a value from

174
00:13:49,180 --> 00:13:53,480
the new parameter or calling one of the
three open functions so the urls is going to be

175
00:13:53,480 --> 00:13:56,550
opened using your operating system's
default browser and you can see in my case

176
00:13:56,550 --> 00:14:00,770
it was chrome let's look at another
function this is the get function this

177
00:14:00,770 --> 00:14:06,160
is described as returning controller object
for the specified browser type so

178
00:14:06,160 --> 00:14:13,470
hopefully you can see the table or the
defined browser types and further down the

179
00:14:13,470 --> 00:14:17,770
document we can see the available methods in a
controller on a controller is provided the three

180
00:14:17,770 --> 00:14:26,120
different ways of opening the URL that
would actually just seen using the controller as you can see their so its

181
00:14:26,120 --> 00:14:29,790
a slightly different way of accessing in
other words I just want to point out

182
00:14:29,790 --> 00:14:34,810
also that we've deliberately avoided the
register function this is a good tip when

183
00:14:34,810 --> 00:14:38,640
reading module documentation focus on the
functions that appear to do what you

184
00:14:38,640 --> 00:14:39,450
want

185
00:14:39,450 --> 00:14:42,990
only try to make sense of the other ones
if you can't find any obvious way to do

186
00:14:42,990 --> 00:14:43,720
something

187
00:14:43,720 --> 00:14:48,180
so the get function provides everything we need
to use a different browser to the system

188
00:14:48,180 --> 00:14:53,780
default so the following code if we go back to the browser I should
actually opened the url in another

189
00:14:53,780 --> 00:15:03,670
browser so if we go back to the code close this
down so comment that code out and if we change the code

190
00:15:03,670 --> 00:15:08,540
and you wanted to open in Google
chrome and I've use that as a default but on your computer you should be able

191
00:15:08,540 --> 00:15:11,150
to type....

192
00:15:11,150 --> 00:15:23,080
.....

193
00:15:23,080 --> 00:15:29,390
......

194
00:15:29,390 --> 00:15:36,200
....so if I run that I should probably get the same result
because I'm actually running chrome

195
00:15:36,200 --> 00:15:39,730
anyway that would be the code that
actually works but because I'm using a

196
00:15:39,730 --> 00:15:46,000
Mac I need to try one from another table
so go back to the documentation

197
00:15:46,000 --> 00:15:59,500
you can see Mac with the mac options I can choose Safari by typing Safari
or whatever the Mac OS X default is and just

198
00:15:59,500 --> 00:16:04,580
looking at this notes here obviously the
Mac OS X ones are only applicable for

199
00:16:04,580 --> 00:16:09,180
the Mac platform and likewise with 2 Windows
default is obviously only applicable to

200
00:16:09,180 --> 00:16:10,280
Windows platform

201
00:16:10,280 --> 00:16:16,550
so Chrome didn't work so let's just try
running chrome in our test code

202
00:16:16,550 --> 00:16:26,520
so Google Chrome and run that you can see that didn't work either so what we can also
try and do again this is probably MAC

203
00:16:26,520 --> 00:16:30,620
specific you should find these commands
I've done here should work ok on

204
00:16:30,620 --> 00:16:34,730
a Windows machine or Linux machine but
on a Mac you might have to do it slightly

205
00:16:34,730 --> 00:16:39,300
different so we can put Chrome...
instead of putting

206
00:16:39,300 --> 00:16:43,950
using we get rid of using and will just make it.....

207
00:16:43,950 --> 00:17:05,560
...lets try running again and see if that works that didn't work so I'll try actually what I did there I made a mistake

208
00:17:05,560 --> 00:17:13,460
so I need to put like so need to close of the bracket
and put .open and you can see .open is now a method within that

209
00:17:13,460 --> 00:17:22,710
function so we close it down and run it again no error this time
but we didn't see it actually open anything

210
00:17:22,710 --> 00:17:27,480
so we're on the right track here so let us try closing that down and putting Google

211
00:17:27,480 --> 00:17:39,950
Chrome run that will try .open_new_tab.....like so

212
00:17:39,950 --> 00:17:56,020
run that close that down and we will just make that chrome again I'll just try one more and again this is a Mac specific problem....

213
00:17:56,020 --> 00:18:03,840
will try and execute that and again no luck so not having much
luck with the Mac version but if we just got back

214
00:18:03,840 --> 00:18:07,350
to the documentation again what we can
do we know that we can get it to work

215
00:18:07,350 --> 00:18:10,380
using Safari so that's something that
does work on a Mac and again these

216
00:18:10,380 --> 00:18:14,330
problems are pretty much because I'm
actually running this on a Mac and you

217
00:18:14,330 --> 00:18:18,220
can see on Windows you should be able to
use Chrome or Google_chrome that

218
00:18:18,220 --> 00:18:21,670
should work just fine but it is not working on
my Mac at the moment so I'm gonna use

219
00:18:21,670 --> 00:18:26,240
Safari which we know I haven't
executed before lets go back and change

220
00:18:26,240 --> 00:18:30,740
the code for that so I'm gonna make it a lot simpler so I'm gonna go back to the code

221
00:18:30,740 --> 00:18:39,780
I have and I'm going to comment out that line for now
I'm gonna put....

222
00:18:39,780 --> 00:18:49,270
...and will put....which should now work
because we are on a Mac and that will only work on a Mac

223
00:18:49,270 --> 00:18:52,910
Chrome sorry Safari....

224
00:18:52,910 --> 00:19:11,620
...lets try that so that worked of screen so I'm going to close the tab down and

225
00:19:11,620 --> 00:19:17,400
opened it moved Safari over to
this screen and I'm just gonna make it big so we got

226
00:19:17,400 --> 00:19:22,260
2 tabs opened as you can see and if I run this
again you can see that came up and work this

227
00:19:22,260 --> 00:19:26,460
time so that's using Safari so basically the
code I was trying to work was Mac

228
00:19:26,460 --> 00:19:30,950
specific and it didn't work because we're
on a Mac but once I started putting Mac

229
00:19:30,950 --> 00:19:36,150
specific code it actually worked and again
getting back to the other code if

230
00:19:36,150 --> 00:19:39,890
you're using these codes on a Windows
machine not Mac OS X and safari but the

231
00:19:39,890 --> 00:19:43,060
other ones you should find that there's
no problems basically problem initially

232
00:19:43,060 --> 00:19:47,700
with those errors was as far as Mac was concerned
it couldn't find Google Chrome and it needs to

233
00:19:47,700 --> 00:19:52,000
be in the system path and it raise an error
and you saw those exceptions coming up

234
00:19:52,000 --> 00:19:55,010
on the screen and you'll be learning how
to deal with those exceptions later in the

235
00:19:55,010 --> 00:19:58,760
course and doing so will provide a way
to check gracefully whether a

236
00:19:58,760 --> 00:20:02,590
particular browser is available so you can
try another one if not so again you might want to

237
00:20:02,590 --> 00:20:07,240
as an exercise just try one of these
options on your computer and see if it

238
00:20:07,240 --> 00:20:10,950
actually works and you can see I actually use safari in my case and just finishing off

239
00:20:10,950 --> 00:20:15,640
I know this is getting quite long but the register
function that we skipped over getting back to the

240
00:20:15,640 --> 00:20:21,710
documentation register here that can be
used to make additional browsers

241
00:20:21,710 --> 00:20:26,100
available when Python doesn't list them in the table so in actual fact it can be

242
00:20:26,100 --> 00:20:29,770
used to make unknown browsers available in the system path and that was

243
00:20:29,770 --> 00:20:35,970
obviously the case here with those errors I was getting however with this bit of the documentation is fairly weak it doesn't

244
00:20:35,970 --> 00:20:42,020
specifically say what the constructor argument is although we could guess
what it does some sort of function there is no

245
00:20:42,020 --> 00:20:46,620
indication of what it should do the final paragraph
of register does say that the function is

246
00:20:46,620 --> 00:20:51,340
only useful if you plan to either set the
browse variable or declaring your own handler

247
00:20:51,340 --> 00:20:56,850
but again what is handler does and what form it should take is unspecified
so if you do get to the point where you feel you need

248
00:20:56,850 --> 00:21:01,340
to use a function or method that's
poorly documented your only real choices

249
00:21:01,340 --> 00:21:04,770
are to searched the internet or examine
the module source code we don't actually

250
00:21:04,770 --> 00:21:05,960
use this function right

251
00:21:05,960 --> 00:21:08,390
now which is fortunate because an
internet search in this particular

252
00:21:08,390 --> 00:21:12,380
function throws up far less information
than is normally available when it's a

253
00:21:12,380 --> 00:21:17,000
bit too soon and of course for examining
the web browser source code so hopefully this tour

254
00:21:17,000 --> 00:21:21,880
of the library documentations has given you
like a solid idea of how to use it

255
00:21:21,880 --> 00:21:26,250
and how to work out what various functions
do and how they used occasionally you'll

256
00:21:26,250 --> 00:21:29,760
find the odd bit of documentation that's not
as good as it should be as in the register

257
00:21:29,760 --> 00:21:34,110
example here on the screen but generally
speaking the Python documentation is

258
00:21:34,110 --> 00:21:38,330
quite good so we are gonna finish this lecture now with 2 last comments that be useful when

259
00:21:38,330 --> 00:21:42,060
looking at documentation and method
descriptions the first is the difference

260
00:21:42,060 --> 00:21:46,170
between arguments and parameters and
why it doesn't matter so strictly

261
00:21:46,170 --> 00:21:49,640
speaking when you write your own
function what you doing is your defining

262
00:21:49,640 --> 00:21:53,170
the parameters that its going to use and
when the function is called these

263
00:21:53,170 --> 00:21:57,420
parameters are replaced with the actual
arguments in practice most programmers

264
00:21:57,420 --> 00:22:01,220
now used to the two words interchangeably
and generally favor the word parameter

265
00:22:01,220 --> 00:22:06,250
over arguments and the Python documentation
does have a glossary entry explaining

266
00:22:06,250 --> 00:22:09,340
the difference but in the description of
the register function that we just

267
00:22:09,340 --> 00:22:12,980
looked at it states that the constructor can
be called without parameters when it

268
00:22:12,980 --> 00:22:17,480
actually means without arguments which
justifies our advise not to worry too much

269
00:22:17,480 --> 00:22:21,520
about the terms and a second thing I want
to point out is the parameter called

270
00:22:21,520 --> 00:22:22,740
self

271
00:22:22,740 --> 00:22:26,930
we are going to be covering classes in the next section
actually and you'll learn about the

272
00:22:26,930 --> 00:22:30,060
difference between functions and methods
but until then when you call a method in

273
00:22:30,060 --> 00:22:33,880
the same way you do a function as we did
with shelve.open for example in the

274
00:22:33,880 --> 00:22:37,580
previous section but in the documentation
for method you see that the first

275
00:22:37,580 --> 00:22:42,630
parameter or argument to a method is self
but you don't have to provide a value

276
00:22:42,630 --> 00:22:45,820
for it when you calling the method Python
takes care of this for you so just

277
00:22:45,820 --> 00:22:50,440
ignore self for now and again this will all
be revealed in covered in detail when we

278
00:22:50,440 --> 00:22:54,840
cover object orientated programming
classes later in the course so that's it

279
00:22:54,840 --> 00:22:57,670
I'm gonna finish is very long video now
and I'll see you in the next video

