1
00:00:05,410 --> 00:00:09,840
In this video, we'll look at the few rules
that we have to observe, when we use var positional

2
00:00:09,840 --> 00:00:14,170
parameters such as star effects
in our colour_print function.

3
00:00:14,170 --> 00:00:20,670
I'll start with that parameter entry in the
glossary - the one we looked at earlier:
https://docs.python.org/3/glossary.html#term-parameter

4
00:00:20,670 --> 00:00:25,980
I'm going to switch to a slide, because we
won't be talking about positional-only parameters.

5
00:00:25,980 --> 00:00:29,670
They're quite advanced - you'd only need to
use them if you were documenting functions

6
00:00:29,670 --> 00:00:33,070
that are implemented in C, for example.

7
00:00:33,070 --> 00:00:37,970
There are 5 different kinds
of parameters that you can use.

8
00:00:37,970 --> 00:00:41,079
As I said, we won't be looking at
positional-only parameters in this course.

9
00:00:41,079 --> 00:00:44,890
The description's blanked out in
the slide, to keep things simple.

10
00:00:44,890 --> 00:00:50,710
When we use the different parameter types
in our functions, we have to use them in the

11
00:00:50,710 --> 00:00:53,280
order that they appear below:

12
00:00:53,280 --> 00:00:59,329
Any positional-or-keyword arguments that we
define, MUST come first in the parameter list.

13
00:00:59,329 --> 00:01:04,400
If we have a var-positional parameter - that's
a parameter that starts with * - then it must

14
00:01:04,400 --> 00:01:06,840
come after any positional-or-keyword arguments.

15
00:01:06,840 --> 00:01:11,569
There's a good reason for that,
as we'll see soon.

16
00:01:11,569 --> 00:01:17,830
Any parameters defined after a var-positional
parameter must be keyword-only arguments (which

17
00:01:17,830 --> 00:01:20,320
includes var-keyword arguments).

18
00:01:20,320 --> 00:01:23,560
Finally, any var-keyword
arguments appear last.

19
00:01:23,560 --> 00:01:27,270
We'll be looking at how to define
var-keyword arguments later.

20
00:01:27,270 --> 00:01:30,070
We need to learn about dictionaries first.

21
00:01:30,070 --> 00:01:36,240
To understand why the ordering is important,
let's consider these rather strange, grey aliens.

22
00:01:37,369 --> 00:01:41,390
They're a very literal species - their brains
are a bit like computers, in that respect.

23
00:01:41,390 --> 00:01:45,750
Here, an adult alien is giving an
instruction to one of the children.

24
00:01:45,750 --> 00:01:46,890
Unfortunately ...

25
00:01:46,890 --> 00:01:52,340
... the instructions are ambiguous.

26
00:01:52,340 --> 00:01:58,910
The small alien had been told to hurry, and did
the best that it could, with those instructions.

27
00:01:58,910 --> 00:02:03,670
If we write ambiguous instructions in our
code, the best we can hope for is an error.

28
00:02:03,670 --> 00:02:06,690
The worst we can hope for,
is that our shoes get eaten!

29
00:02:06,690 --> 00:02:11,230
In the next video, we'll see how our code
would be ambiguous, if we don't define our

30
00:02:11,230 --> 00:02:15,330
parameters in the order I described.

