1 00:00:00,780 --> 00:00:02,910 Biton namespace and scope. 2 00:00:04,530 --> 00:00:11,370 Namespace in Biton in Python namespace is a collection of names which holds as a mapping of every name 3 00:00:11,660 --> 00:00:14,580 which you have defined the corresponding objects. 4 00:00:14,730 --> 00:00:19,560 So objects will have different names and this names will be defined in some namespace. 5 00:00:20,130 --> 00:00:24,240 So different names, spaces can coexist at a given time. 6 00:00:24,510 --> 00:00:31,320 But that completely they are completely isolated in namespace containing all the building names. 7 00:00:31,650 --> 00:00:39,690 It is created when you start the python interpreter and exists as long as we don't exit from the environment. 8 00:00:41,550 --> 00:00:45,330 So namespace in Biton can be can be drawn. 9 00:00:45,400 --> 00:00:51,660 That can be explained using these respective Degner so models can have various functions and classes, 10 00:00:52,470 --> 00:00:58,710 a local namespace is created when the function is called, which has all the names defined in it. 11 00:00:59,190 --> 00:01:02,120 Similarly is the case with the class also. 12 00:01:02,310 --> 00:01:05,110 So just sinisi it with having one namespace. 13 00:01:05,940 --> 00:01:10,740 This a function local limn space with all the variables, all the objects. 14 00:01:10,770 --> 00:01:13,050 What about you have defined in this particular function? 15 00:01:13,410 --> 00:01:18,330 So they'll be mapped here and then we're having this model global namespace. 16 00:01:18,690 --> 00:01:20,400 And this is this particular function. 17 00:01:20,400 --> 00:01:22,590 Local namespace will be the part of this. 18 00:01:22,890 --> 00:01:27,780 And then we're having the built in namespace for the respective application in execution. 19 00:01:28,350 --> 00:01:32,490 So I think for the better understanding, let us look for a practical demonstration where you will be 20 00:01:32,490 --> 00:01:35,880 showing you that how this namespace can be used in Biton. 21 00:01:36,210 --> 00:01:39,870 So here is the demonstration identifier. 22 00:01:39,950 --> 00:01:45,270 It is nothing but one name, which is simply a name given to Biton objects. 23 00:01:45,660 --> 00:01:51,210 And you can get the address in Gramme off some object through the building function. 24 00:01:51,240 --> 00:01:52,150 That is our idea. 25 00:01:52,500 --> 00:01:54,300 So easy using this idea function. 26 00:01:54,330 --> 00:01:57,600 We can easily get the idea of the respective identifier. 27 00:01:58,320 --> 00:02:02,880 So now you can get the different forms of I.D. in a word execution. 28 00:02:03,150 --> 00:02:04,060 What about the I.D.? 29 00:02:04,230 --> 00:02:05,970 We have written here under the comment. 30 00:02:06,480 --> 00:02:07,660 So is the goal to. 31 00:02:08,430 --> 00:02:10,260 So I went to print the idea of two. 32 00:02:10,350 --> 00:02:12,300 I want to bring the idea of it also. 33 00:02:12,610 --> 00:02:13,830 So see what we're doing. 34 00:02:15,030 --> 00:02:16,230 So here is the outcome. 35 00:02:16,860 --> 00:02:24,550 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 36 00:02:24,580 --> 00:02:25,770 it is able to do. 37 00:02:25,770 --> 00:02:28,010 And we're trying to print the idea of eight. 38 00:02:28,080 --> 00:02:29,880 We're finding that one is this idea. 39 00:02:29,920 --> 00:02:32,370 It's also the same as we had before. 40 00:02:32,760 --> 00:02:35,220 Next one is that we have made is equal to a plus one. 41 00:02:35,250 --> 00:02:37,770 So eight is now holding the value three here. 42 00:02:38,250 --> 00:02:42,690 So if we print the idea up eight, we're finding that the idea of A has got different. 43 00:02:43,230 --> 00:02:48,510 And it is the idea which is different from the idea of a part of what we got, the output outcome. 44 00:02:49,450 --> 00:02:55,770 The next idea of three, if I print this idea up three, I'm getting this one as one seven six four 45 00:02:55,770 --> 00:02:57,180 five one six six four. 46 00:02:57,540 --> 00:03:02,880 So that means it is the same as the idea of it because it is done holding the value through here. 47 00:03:03,750 --> 00:03:09,510 If they assign B is equal to two and if they want to print the idea of two getting the same idea which 48 00:03:09,510 --> 00:03:14,390 you had increase up eight or Dinkas up to when it was having the value here. 49 00:03:15,450 --> 00:03:18,240 So if I print that is but to one if I go on printing. 50 00:03:19,090 --> 00:03:19,920 Say, print. 51 00:03:22,740 --> 00:03:30,460 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 52 00:03:30,460 --> 00:03:31,030 been assigned. 53 00:03:31,660 --> 00:03:33,170 So in this way, you discuss that. 54 00:03:33,220 --> 00:03:40,960 What is are identified and what is an Aidid ideal starting but one building function available in Biton 55 00:03:40,960 --> 00:03:44,440 to print their respective memory address in the RAM. 56 00:03:45,520 --> 00:03:47,200 That this is what we have printed. 57 00:03:47,230 --> 00:03:50,070 If we exude the same code, you might be getting some different ideas. 58 00:03:50,070 --> 00:03:56,080 So that will be decided by that during the execution of McCall, which memory block is free? 59 00:03:56,380 --> 00:04:02,310 And depending upon that, the memory allegation against the vegetables will be done by the system. 60 00:04:03,430 --> 00:04:04,510 Next one is this cop. 61 00:04:05,330 --> 00:04:10,250 So we are having this outer function where having this inner function, so it is also known as nested 62 00:04:10,250 --> 00:04:10,670 function. 63 00:04:11,150 --> 00:04:12,200 So global aid. 64 00:04:12,230 --> 00:04:15,260 That means I'm defining one variable within outer function. 65 00:04:15,290 --> 00:04:16,940 But the scope will be global. 66 00:04:17,180 --> 00:04:19,320 So that's why you abused the key word global here. 67 00:04:20,060 --> 00:04:22,640 This valuable A has been initialized with 20. 68 00:04:23,330 --> 00:04:24,890 Now, this is my inner function. 69 00:04:25,100 --> 00:04:28,580 There is a nested function which is existing inside the outer one. 70 00:04:29,060 --> 00:04:34,130 You can look at the indentation and you can get the idea that this particular inner function is within 71 00:04:34,130 --> 00:04:34,910 the outer function. 72 00:04:35,600 --> 00:04:36,830 Here to have defining this A. 73 00:04:36,920 --> 00:04:38,150 But it is not a new way. 74 00:04:38,180 --> 00:04:44,360 But it is that globally, which you referred earlier, that it has got updated with the value of Kurti 75 00:04:44,360 --> 00:04:48,890 and the value of A has got printed from the outer function designer function. 76 00:04:48,950 --> 00:04:52,310 Whatever you have defined just now, it has got executed. 77 00:04:52,400 --> 00:04:53,240 It has been called. 78 00:04:53,270 --> 00:04:59,660 So during execution it will have this execution and we are printing this value up a applet exiting from 79 00:04:59,660 --> 00:05:02,090 the inner function within outer function. 80 00:05:02,960 --> 00:05:05,120 So I'm reading this is the routine at first. 81 00:05:05,600 --> 00:05:06,890 So that is there it is. 82 00:05:07,340 --> 00:05:08,790 I'm printing the value of it. 83 00:05:09,380 --> 00:05:10,550 So it is printing then. 84 00:05:11,120 --> 00:05:13,010 Now we're calling this outer function. 85 00:05:13,100 --> 00:05:15,410 So when the content will be going to the outer function. 86 00:05:15,440 --> 00:05:17,400 This is actually the global link. 87 00:05:17,690 --> 00:05:20,130 That means that eight, which is right now holding the value ten. 88 00:05:20,780 --> 00:05:23,380 So that ten has got updated with the 20. 89 00:05:23,480 --> 00:05:24,860 But we didn't print anything. 90 00:05:25,370 --> 00:05:26,990 Then the inner function will be called. 91 00:05:27,080 --> 00:05:30,830 So inner function is also defined the same global available eight. 92 00:05:30,890 --> 00:05:36,350 So this is available in the global scope and that it will be used in the inner function. 93 00:05:37,010 --> 00:05:38,440 Now it is equal to 30. 94 00:05:38,480 --> 00:05:41,230 Now this party is operating the global in scope. 95 00:05:41,940 --> 00:05:44,090 The eight which is defined in the global scope. 96 00:05:44,360 --> 00:05:46,040 Now we are printing this value up eight. 97 00:05:46,140 --> 00:05:49,730 So it is printing 30 here optical in this inner function. 98 00:05:49,790 --> 00:05:52,640 Again, we are printing this value up eight from the outer function. 99 00:05:53,180 --> 00:05:54,460 Then it is printing 30. 100 00:05:54,980 --> 00:06:00,260 And after calling this outer function, if you print the value of it here, I'm getting CRT back again. 101 00:06:00,800 --> 00:06:01,790 So it is dear. 102 00:06:02,030 --> 00:06:03,810 It is giving me the idea. 103 00:06:03,830 --> 00:06:04,950 It is giving us idea. 104 00:06:05,060 --> 00:06:06,620 What is the scope here? 105 00:06:07,040 --> 00:06:09,550 And when about one variable is in one scope. 106 00:06:09,830 --> 00:06:14,230 Then how to access that variable from some inner scope using the global keyword. 107 00:06:14,570 --> 00:06:20,750 As we did in our coding in this demonstration web discussed that how to define what is happening when 108 00:06:20,750 --> 00:06:21,800 anybody were defining one. 109 00:06:21,860 --> 00:06:22,370 I didn't. 110 00:06:22,770 --> 00:06:23,960 In about python coding. 111 00:06:24,680 --> 00:06:25,850 Thanks for watching this video.