This is the last lecture in this section, and I wanted to touch on a few issues, it has to do with
differences between you both and my proposal raise and see Python.
Obviously, those two languages are very, very close to each other.
But they're not identical in this because micro python has to make certain compromises because it is
operating on platforms with very limited resources.
So I'm going to show you a couple of examples where those differences actually manifested in the come
out.
And I also invite you to take a little bit of time to do the reading.
So in the micro python documentation, you'll find a whole section dedicated to the differences between
micro python and C Python and just maybe take your time to browse through them.
I'm only going to show you a couple of indicative examples that can often confuse people, especially
the second example.
And the first example that I'm going to show you has to do with spaces.
So because my python is optimized for speed and again can optimize to operate on platforms with limited
resources, is not very forgiving to typing errors that Python can forgive.
So one of those is spaces I'm going to show you live.
So I've got Sony on the left side that is running Python three point seven point nine, which comes
with the only instance that I'm using.
And on the other side, I've got a serial connection to my especially to running my python.
So I'm going to run a little bit of code here to see one example of the differences between the two
types of python in Python, three point o if you do something such as one and zero.
So what I'm doing here is a boolean operation.
I'm using the end keyword to do a boolean comparison between one and zero.
And Python has no problem with that.
It's going to evaluate it and give us a correct result.
So do the same thing on micro Python will get in there a message.
So we're going to work unless it's perfectly syntax like this and then it will work.
So Spaces is treated differently between Python and micro python.
And there's an example here in this section is very well written and shows you how each of those differences
manifest on the two different platforms.
So next, I want to show you a more substantial difference between the two.
And that brings us back to the previous lecture where you learnt about classes and objects to what to
do is I'm going to create a class definition, which you learned about in the previous lecture.
And here it is on C Python, two point seven point nine.
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
have to copy this one line at a time.
So bear with me here.
OK, so there's my calculator class on Micro Python so we can use the two classes in the exact same
way and create an instance first and both sides, no problem.
Let's do it in addition.
And it works the same each way.
Now, let's go ahead now and create a new instance of the calculator class at this time, pass an incorrect
number of parameters.
So there's calculator with a single parameter on one side.
I'm going to do the same thing on the other side.
All right, so let's now look at the traceback information that comes from the Python interpreter to
see, Python is telling me that there is one missing required positional argument telling me that number
two is missing.
So quite a lot of information here.
One requite position of primary is missing them to no one has been provided on the other side through
micro.
Python is telling me that there are three positional arguments.
Only two were given.
In fact, I only gave you one.
If you look at actually what you did, just one parameter was given my code.
Python is telling me that I've given two parameters and there are three or not.
And this is because it is counting self as a parameter so that if we got one, two, three parameter
squares in C Python, it's ignoring self and it knows that there are two parameters that have been provided
and it even tells you which parameter it's missing.
So the interpreter obviously has got more capability on C Python.
It gives you more precise feedback and information that helps you with debugging and it gives you a
correct number of arguments for, in this case, the Init function compared to what Microplace and does.
Now, this is basically for people that are coming from see, Python can be very confusing because they
are used to take accurate information from the C Python interpreter.
And the difference in the numbers here can easily throw people off until you realize that this difference
does exist.
So anyway, I do recommend that you spend a little bit of time to have a look at the information provided
by the micro python documentation.
And that will really prepare you, Bill, to be able to work with local python in the remainder of this
course.