1
00:00:01,130 --> 00:00:07,110
This is the last lecture in this section, and I wanted to touch on a few issues, it has to do with

2
00:00:07,110 --> 00:00:12,210
differences between you both and my proposal raise and see Python.

3
00:00:12,640 --> 00:00:15,660
Obviously, those two languages are very, very close to each other.

4
00:00:15,660 --> 00:00:22,440
But they're not identical in this because micro python has to make certain compromises because it is

5
00:00:22,440 --> 00:00:26,140
operating on platforms with very limited resources.

6
00:00:26,730 --> 00:00:33,480
So I'm going to show you a couple of examples where those differences actually manifested in the come

7
00:00:33,480 --> 00:00:33,900
out.

8
00:00:34,170 --> 00:00:39,160
And I also invite you to take a little bit of time to do the reading.

9
00:00:39,510 --> 00:00:45,690
So in the micro python documentation, you'll find a whole section dedicated to the differences between

10
00:00:45,930 --> 00:00:52,020
micro python and C Python and just maybe take your time to browse through them.

11
00:00:52,050 --> 00:00:57,990
I'm only going to show you a couple of indicative examples that can often confuse people, especially

12
00:00:57,990 --> 00:00:58,980
the second example.

13
00:00:59,250 --> 00:01:03,090
And the first example that I'm going to show you has to do with spaces.

14
00:01:03,450 --> 00:01:11,160
So because my python is optimized for speed and again can optimize to operate on platforms with limited

15
00:01:11,160 --> 00:01:17,970
resources, is not very forgiving to typing errors that Python can forgive.

16
00:01:18,450 --> 00:01:23,670
So one of those is spaces I'm going to show you live.

17
00:01:24,300 --> 00:01:32,460
So I've got Sony on the left side that is running Python three point seven point nine, which comes

18
00:01:32,460 --> 00:01:34,940
with the only instance that I'm using.

19
00:01:35,280 --> 00:01:41,160
And on the other side, I've got a serial connection to my especially to running my python.

20
00:01:41,640 --> 00:01:49,650
So I'm going to run a little bit of code here to see one example of the differences between the two

21
00:01:49,650 --> 00:01:58,500
types of python in Python, three point o if you do something such as one and zero.

22
00:01:58,550 --> 00:02:01,740
So what I'm doing here is a boolean operation.

23
00:02:02,520 --> 00:02:08,030
I'm using the end keyword to do a boolean comparison between one and zero.

24
00:02:08,520 --> 00:02:11,840
And Python has no problem with that.

25
00:02:11,850 --> 00:02:16,070
It's going to evaluate it and give us a correct result.

26
00:02:16,800 --> 00:02:23,000
So do the same thing on micro Python will get in there a message.

27
00:02:23,580 --> 00:02:29,090
So we're going to work unless it's perfectly syntax like this and then it will work.

28
00:02:29,550 --> 00:02:34,650
So Spaces is treated differently between Python and micro python.

29
00:02:34,660 --> 00:02:41,460
And there's an example here in this section is very well written and shows you how each of those differences

30
00:02:41,460 --> 00:02:43,740
manifest on the two different platforms.

31
00:02:44,190 --> 00:02:47,280
So next, I want to show you a more substantial difference between the two.

32
00:02:47,280 --> 00:02:54,150
And that brings us back to the previous lecture where you learnt about classes and objects to what to

33
00:02:54,150 --> 00:03:04,050
do is I'm going to create a class definition, which you learned about in the previous lecture.

34
00:03:04,410 --> 00:03:08,440
And here it is on C Python, two point seven point nine.

35
00:03:08,450 --> 00:03:15,390
And I'm going to do the same thing on the E.S.P three two side running micro python that I'm going to

36
00:03:15,390 --> 00:03:17,730
have to copy this one line at a time.

37
00:03:17,740 --> 00:03:18,870
So bear with me here.

38
00:03:29,230 --> 00:03:37,480
OK, so there's my calculator class on Micro Python so we can use the two classes in the exact same

39
00:03:37,480 --> 00:03:42,480
way and create an instance first and both sides, no problem.

40
00:03:42,740 --> 00:03:44,050
Let's do it in addition.

41
00:03:47,780 --> 00:03:50,510
And it works the same each way.

42
00:03:50,960 --> 00:04:00,560
Now, let's go ahead now and create a new instance of the calculator class at this time, pass an incorrect

43
00:04:00,560 --> 00:04:02,780
number of parameters.

44
00:04:03,780 --> 00:04:08,370
So there's calculator with a single parameter on one side.

45
00:04:09,360 --> 00:04:11,030
I'm going to do the same thing on the other side.

46
00:04:12,650 --> 00:04:20,870
All right, so let's now look at the traceback information that comes from the Python interpreter to

47
00:04:20,870 --> 00:04:28,700
see, Python is telling me that there is one missing required positional argument telling me that number

48
00:04:28,700 --> 00:04:30,060
two is missing.

49
00:04:30,530 --> 00:04:32,590
So quite a lot of information here.

50
00:04:33,680 --> 00:04:39,710
One requite position of primary is missing them to no one has been provided on the other side through

51
00:04:40,910 --> 00:04:41,380
micro.

52
00:04:41,390 --> 00:04:45,230
Python is telling me that there are three positional arguments.

53
00:04:45,260 --> 00:04:47,120
Only two were given.

54
00:04:47,120 --> 00:04:49,280
In fact, I only gave you one.

55
00:04:49,790 --> 00:04:55,700
If you look at actually what you did, just one parameter was given my code.

56
00:04:55,730 --> 00:05:00,560
Python is telling me that I've given two parameters and there are three or not.

57
00:05:00,830 --> 00:05:08,360
And this is because it is counting self as a parameter so that if we got one, two, three parameter

58
00:05:08,360 --> 00:05:16,480
squares in C Python, it's ignoring self and it knows that there are two parameters that have been provided

59
00:05:16,490 --> 00:05:18,770
and it even tells you which parameter it's missing.

60
00:05:19,190 --> 00:05:24,400
So the interpreter obviously has got more capability on C Python.

61
00:05:24,770 --> 00:05:31,940
It gives you more precise feedback and information that helps you with debugging and it gives you a

62
00:05:31,940 --> 00:05:40,100
correct number of arguments for, in this case, the Init function compared to what Microplace and does.

63
00:05:40,370 --> 00:05:45,800
Now, this is basically for people that are coming from see, Python can be very confusing because they

64
00:05:45,800 --> 00:05:51,970
are used to take accurate information from the C Python interpreter.

65
00:05:52,340 --> 00:05:58,940
And the difference in the numbers here can easily throw people off until you realize that this difference

66
00:05:58,940 --> 00:05:59,870
does exist.

67
00:06:00,800 --> 00:06:08,060
So anyway, I do recommend that you spend a little bit of time to have a look at the information provided

68
00:06:08,300 --> 00:06:11,060
by the micro python documentation.

69
00:06:12,230 --> 00:06:19,520
And that will really prepare you, Bill, to be able to work with local python in the remainder of this

70
00:06:19,520 --> 00:06:19,910
course.
