Biton namespace and scope.
Namespace in Biton in Python namespace is a collection of names which holds as a mapping of every name
which you have defined the corresponding objects.
So objects will have different names and this names will be defined in some namespace.
So different names, spaces can coexist at a given time.
But that completely they are completely isolated in namespace containing all the building names.
It is created when you start the python interpreter and exists as long as we don't exit from the environment.
So namespace in Biton can be can be drawn.
That can be explained using these respective Degner so models can have various functions and classes,
a local namespace is created when the function is called, which has all the names defined in it.
Similarly is the case with the class also.
So just sinisi it with having one namespace.
This a function local limn space with all the variables, all the objects.
What about you have defined in this particular function?
So they'll be mapped here and then we're having this model global namespace.
And this is this particular function.
Local namespace will be the part of this.
And then we're having the built in namespace for the respective application in execution.
So I think for the better understanding, let us look for a practical demonstration where you will be
showing you that how this namespace can be used in Biton.
So here is the demonstration identifier.
It is nothing but one name, which is simply a name given to Biton objects.
And you can get the address in Gramme off some object through the building function.
That is our idea.
So easy using this idea function.
We can easily get the idea of the respective identifier.
So now you can get the different forms of I.D. in a word execution.
What about the I.D.?
We have written here under the comment.
So is the goal to.
So I went to print the idea of two.
I want to bring the idea of it also.
So see what we're doing.
So here is the outcome.
So the idea up to an idea of a both are some you can easily find that book are some it can do it sending
it is able to do.
And we're trying to print the idea of eight.
We're finding that one is this idea.
It's also the same as we had before.
Next one is that we have made is equal to a plus one.
So eight is now holding the value three here.
So if we print the idea up eight, we're finding that the idea of A has got different.
And it is the idea which is different from the idea of a part of what we got, the output outcome.
The next idea of three, if I print this idea up three, I'm getting this one as one seven six four
five one six six four.
So that means it is the same as the idea of it because it is done holding the value through here.
If they assign B is equal to two and if they want to print the idea of two getting the same idea which
you had increase up eight or Dinkas up to when it was having the value here.
So if I print that is but to one if I go on printing.
Say, print.
So if I print, I can find that the idea of to an idea of B both are same because Baeza got to do has
been assigned.
So in this way, you discuss that.
What is are identified and what is an Aidid ideal starting but one building function available in Biton
to print their respective memory address in the RAM.
That this is what we have printed.
If we exude the same code, you might be getting some different ideas.
So that will be decided by that during the execution of McCall, which memory block is free?
And depending upon that, the memory allegation against the vegetables will be done by the system.
Next one is this cop.
So we are having this outer function where having this inner function, so it is also known as nested
function.
So global aid.
That means I'm defining one variable within outer function.
But the scope will be global.
So that's why you abused the key word global here.
This valuable A has been initialized with 20.
Now, this is my inner function.
There is a nested function which is existing inside the outer one.
You can look at the indentation and you can get the idea that this particular inner function is within
the outer function.
Here to have defining this A.
But it is not a new way.
But it is that globally, which you referred earlier, that it has got updated with the value of Kurti
and the value of A has got printed from the outer function designer function.
Whatever you have defined just now, it has got executed.
It has been called.
So during execution it will have this execution and we are printing this value up a applet exiting from
the inner function within outer function.
So I'm reading this is the routine at first.
So that is there it is.
I'm printing the value of it.
So it is printing then.
Now we're calling this outer function.
So when the content will be going to the outer function.
This is actually the global link.
That means that eight, which is right now holding the value ten.
So that ten has got updated with the 20.
But we didn't print anything.
Then the inner function will be called.
So inner function is also defined the same global available eight.
So this is available in the global scope and that it will be used in the inner function.
Now it is equal to 30.
Now this party is operating the global in scope.
The eight which is defined in the global scope.
Now we are printing this value up eight.
So it is printing 30 here optical in this inner function.
Again, we are printing this value up eight from the outer function.
Then it is printing 30.
And after calling this outer function, if you print the value of it here, I'm getting CRT back again.
So it is dear.
It is giving me the idea.
It is giving us idea.
What is the scope here?
And when about one variable is in one scope.
Then how to access that variable from some inner scope using the global keyword.
As we did in our coding in this demonstration web discussed that how to define what is happening when
anybody were defining one.
I didn't.
In about python coding.
Thanks for watching this video.