 Now, all of us stored one script to create a curve, I called it what script underscore curve, I hope all of you saved some script or other to create a picture. Now, we have been doing a bit of hand waving, we said how do we run that script? You open ipython and from inside type percentage run minus i script name, that is actually a bit of a bullshit, why? A python script should not require an IDE to run that, when you submit or when you distribute a program, you distribute the executable or the runtime engine if it is a Java program, but you do not distribute the IDE, correct, ipython is an IDE. So, we only told you how to run it from within the IDE. So, we have to run it from outside the IDE. So, I suggest let us do this, let us go to the command prompt, there must be some pi file somewhere, yeah minus here curve script dot pi. So, how to run the python file? We know already, right? We know it is slightly more animation on the decibel level increase would be nice. So, how do you do that python? Curve underscore whatever dot pi should run the script, correct? Please run your scripts. We claimed you have written python scripts, correct? Yes or no? But we cheated by running them from within ipython. So, let us verify we have actually written python scripts or not. So, run it at the command prompt, whatever is your python script and see whether you get that curve picture, whatever you prepared it for. So, what happens when you run it? Linspace not defined. So, obviously, we were cheating, correct? Because inside ipython somewhere linspace was not a problem, when you run like this it is a problem which means we have not really said how to write a script. So, sort of cheated you, it is time to do the un-cheating. So, what do you mean by that? Let us run it. I do not know who linspace is, good? Which brings us to what we are talking about? The idea of namespaces and modules is what we want to focus on. Each of these symbols is defined in a library. A symbol could be the name of a function or the name of a constant. P i is a constant that is defined somewhere. So, that symbol has meaning there. Similarly, linspace is a function that also has meaning only inside a particular library. So, when we said ipython minus pi lab we were sort of sweeping under the carpet or rather we were preparing a lot of background work without committing or explaining what we are doing. When we type ipython minus pi lab and hit enter all the libraries get loaded. So, there is no worry about where to find linspace because linspace is already in your pocket because you have said ipython minus pi lab. So, we need to explicitly say I want that linspace which is in psi pi. I want plot and plot where do I get plot? Oh, you get it from pi lab. So, that the python script can actually run it. So, let us see how to do that part. Let us edit this file. I will use an editor of my choice. You may choose any editor of your choice. So, the way to do is import psi pi import pi lab. Now, linspace comes from psi pi. So, say psi pi dot linspace plot comes from pi lab say pi lab dot p. Similarly, x label comes from pi lab. Obviously, we cannot see anything if it is like this. So, we need to do a pi lab dot show. Now, if we run this let us see what happens. If anybody was noticing you know I made one error sign function sign is missing. Let us find out what is missing pi is not defined. See 2 star pi pi is also defined in psi pi. So, we will fix that next. Like I said psi ram right psi ram opined maybe the cause is also not defined. Let us see whether that is true which is what you said earlier correct. So, we will fix that cause is defined in more than one place, but we will settle for psi pi for the moment. Once again there is another reference to pi which we forgot to fix which is exactly the same thing we produced with x cosine x title everything in place. So, this tells you about the idea of modules in python and how do we import existing functionality. People we were talking in the morning asked what is this numpy and things like that. So, people added functionality to core python by adding arrays are added in numpy and so on and built it by separate libraries psi pi, pi lab or different libraries. That plot lab is wrapped around by pi lab psi pi is scientific python that is numpy is numeric python. So, psi pi actually pulls in all of numpy itself. So, different packages different modules if you want if you like that name better implement different pieces of related functionality. Pi lab as you already know is implementing all plotting and related functionality. Psi pi is implementing all scientific computational functionality which is why cause sign all the hyperbolic usual special functions all of them are in psi pi. And you saw psi pi has sub modules like optimize from which we picked up f solve integrate from which we picked up ODE. So, psi pi is large package with specialized packages for differential equation solution and so on. So, the correct way to use them is like shown here. There is a wrong way to use which is saying from psi pi import star then you do not have to type that psi pi every time which is exactly what import minus pi lab is doing in the background. It is effectively saying it is as a u type from psi pi import star. But this idea of a a dot module dot symbol is lot better because it allows you to have different modules define the same symbol with different meanings as relevant to the module. If you say from psi pi import star you cannot have a P i with a different meaning anywhere else because there is only one P i because P i now is a global symbol. If you instead said import psi pi and said psi pi dot P i there is another module cal plus where I have defined a different P i I can say cal dot P i they will refer to two different entities understood. So, in the early when you are working interactively you do not want to type psi pi dot pi lab dot every time. So, it is perfectly ok to say i pi then minus pi lab, but when you write scripts you should ensure you do it the right way. There are one or two minor improvements available for example, I can say import psi pi as S P and then instead of typing psi pi every time type S P dot linspace and so on. Some people prefer that style their logic being particularly if you use some uppercase and things like that it stands out what modules are used. I consider it rather bad idea psi pi is psi pi I know I am importing a module. Now, I have to figure out what is S P that to me seems an extra bit of work as typing psi pi saving that does not seem to be to be worth it. This is typically the idea done by people who come from the windows world. The unit they will set up a keyboard macro so that you would not have to type psi pi every time that is what I will do. I will set up a keyboard macro then so that I do not type psi pi every time I may type S P it will expand to psi pi. Readability is more important than any typing trouble, but anyway every person to himself or herself all right. So, what is a module let us spend a little time talking about it a module is what you could call a library it is essentially a collection of python code it could be a collection of C code and so on. For example, psi pi is wrappers around the complete linear algebra modules or wrappers around a package called LA pack which is written in FORTRAN by the way. No one has written better linear algebra modules in the last 50 years nothing to beat FORTRAN code even today. So, LA pack is wrapped around and called from python. So, you do not know you are using FORTRAN code, but you are whenever you use psi pi, but you use it with the python way of doing things. So, like that each package packages, implements wraps around different pieces of functionality for example, there is a HTTP lib for doing web related things there is a numpy for array and the similar implementation psi pi for all of this pi lab for plotting and so on. Whatever you want to think of there would be a library already for that and how do you know what are the things that library implements python supports heavy introspection. So, you can actually ask it and then get to see it what are the symbols exported and so on creating your own modules is also easy we will talk about it in a minute. If we write a function like this, we are coming to an important point. So, whether it is possible to include that it is not possible no if suppose I want to run this program that is solving differential equation other things from python itself, but I have not installed ipython. You do not need to. It will be automatically implemented. This script has not depending on ipython. So, it will automatically implement that imported the lib sci pi. No, it will not. We implemented it. We have implemented it import psi pi. We have made it in bring it in. If you type ipython pi lab then it is as good as typing from psi pi import star. So, that you do not have to type psi pi every time which is fine for interactive work you do not want to be typing you want to explore fast. So, if you want to replace that you do not have ipython in python you type from psi pi import star from pi lab import star then in the python prompt itself you can do the same thing. Let us do that and convince ourselves. This is the python prompt. Now, let me say print pi boom what pi who pi where pi of course we do not say anything about it. So, we say import psi pi. Now, we say print psi pi. I made a small mistake. Let us take it from the beginning. No idea what pi is. No idea what psi pi is either because it does not know psi pi from madam. You have to say import psi pi. Now, it knows what psi pi is and brings that code into the now print psi pi dot tri works. This is a bad way of doing things acceptable only for interactively. What is the advantage? Now, there is no need to say psi pi dot. If you say import psi pi you have to say psi pi dot pi. If you say from psi pi import star that all the symbols are in the current names space which obviously means some names may be overwritten. If there are some symbols brought in from psi pi which shadow the names in yours you are finished. Often what people do they will use there is a built in function called str correct. You saw it and many of you I am sure used a variable called str also. If you say str equal to let us see this first str123 this is the function. Now, if you said str object is not callable. What made it not callable? You have overwritten the function called str with a string called str. This is the type of problem that can occur if you do from psi pi import star. Nothing is lost here. Del str that hollow is dead. If you say del str this hollow is dead now. So, the masking of the str function disappears because it is only temporary. You created a symbol str and pointed it to a string. Instead of you overwrote the pointer address essentially once you remove to the point the pointer restored to the earlier value. But such nice things may not happen if you do not even know such overwriting is taking place by using from psi pi import star type of error. So, but obviously when you are trying to interactively explore no one wants to type psi pi psi pi every time. So, it is ok to do it and the way is to if you do not want to use i python or you do not have i python the way to do it is this like we said just now. As you can see we are running all of this from inside python not i python. I python gives additional nice it is like plot question mark that is not available inside python. Inside the python interpreter, python interpreter does not know anything more. I python is an IDE. So, when you whatever you type it grabs it checks whether it is a special symbol it has meaning for like percentage hiss acts on it if it does not it hands it over. But if you do not have i python does not mean what we talked about today cannot be done here is the way to do it. But percentage hiss question mark would not work because they are very specific to i python. Does it answer your question all right. So, how do we write our own modules? This is important enough. So, may request all of us to do whatever we do to wake up thoroughly whether you remember solve or f solve will not make much of difference, but whether you remember this or not will make a lot of difference. We have been importing pi lab importing psi pi and using. You know when you write programs you would like to write your own functions and import them and use in other programs. How do you use that? One simple way is to say you simply write it save it as a script and then let us do just that. I am sure you already written the gcd function enough time. Now, you have written that gcd pi let us see please note it did not give any error which means import succeeded. So, we have written a module called gcd and we have used it. So, what are all the symbols that gcd exports? A whole host of them which are standard for every module plus a symbol called gcd. So, how do you use the gcd function now? If I hit enter what will happen? What will happen? All right. Thanks for not listening so far. What will happen is gcd symbol is not defined. Where is it defined? In module gcd. So, how do you access it? gcd dot gcd. So, only if I do that I will get it not very difficult, but requires an alert mind not exactly available in good supply at 5 p.m. So, this is how one writes one's own modules. Obviously, we wrote a toy module with only one function it could have 10 functions. You could have an LCM in it you could have something else in it and all that. So, you will use gcd dot gcd gc dot LCM and so on. The name of the module is the name of the dot pi 5. Where is it coming from? It must be in the path where it can be picked up. There are standard locations in the operating system. If you are discussing Linux operating system it will be slash usr slash share slash site python 2.6 slash site packages. Please do not write down do not even bother to remember it. All you need to know is there are standard locations. So, if you want to put yours it has to be in a standard location. Otherwise, if you are using for your convenience it has to be in the current directory because current directory is a nice location everybody looks there. So, but there are some problems with this. Why? Typically, how would you write a module? How do you know gcd works? In the case of gcd it may be different, but in the case of a different package some more work may be required. So, how do you know it is working? So, it is normally a good idea to write test code which verifies it is working. What can we do? Now, this will simply print 4, but how do you know whether it is right or wrong? We are anticipating a little bit of tomorrow, but anything you write like this is very poor. Why? 1, it will print 4 does not tell you anything. Is 4 right or wrong? You do not know, but when typing the code you know what is the expected answer. So, any testing you write should not be diagnostic display. Instead, you should think more and say you know what you have to say if. Unfortunately, that is not a way to say if. Yes, gcd is unfortunately in a poor color for visibility. So, this is better test code. So, what happens? A good test suite is as many data as you think necessary. Obviously, we are only showing the idea. So, in a real life implementation, you would not do this badly because you may want some 10 pieces of data and you are not going to type if gcd a comma b 10 times. Instead, what will you do? You will do something like, I will do that. It does not work. BT100 still is color. Anyway, so look at this. Here we put the test data in a variable called test data and we use the far loop to step through. This is more standard way of providing your own test code. So, this way whatever modules you write, whatever functionality you implement carries its own test code. So, people can check it. You should do that, but there is a problem here. What is the problem? Let us see the problem in a minute. It is running all this when you import. You do not want that. Anyway, there is a problem there to start with. That is bad enough, but the important thing is, this indentation is one part, but notice how this is not what you want. Whenever you import sci-pi, if it printed some 800 lines, it is not a good thing, correct? So, you want the test, but you do not. This is not right, which brings us to the right way of doing it, which is where we will stop today's sessions. And the right way of doing it is another feature of Python. We want to say, you know what? We want to run this code. If it is running as a script standalone, we want to run this code. That means somebody is trying to check whether our module is working. If somebody is importing it, they are not running our code. We do not want to run this. That is what we want to say. And Python allows you to say it very simply. Put one big if saying, if the underscore underscore name underscore underscore is underscore underscore main underscore underscore. That means it is being run as a script. Remember, it sees main as the entry point. Same idea. When a program is being run, its name is main. So, if your name is main, that means somebody is running the script standalone, do all this. If not, nothing is specified, so nothing will be done. Let us see the result. Ah, there you are. So, this is the code. The underline is strings. What is the, what is strings is underline. So, this is the code we are having. Now, this is a very powerful feature of Python. This is the way you build a nice module. The module comes with its own test code, but the test code does not interfere with using it, only with testing it. So, let us see how that plays out. So, I say Python gcd.py. The test code comes with the result. I say import gcd, nothing else, because that code is in that if name is main. Remember this, because we are going to expect you to use this to build modules as part of the exercises. All right. That happily or not so happily brings us to the end of the day sessions, but not the end of the day's work. Any questions? What you write there as a capital term, that is syntax. Okay. That is what is called an environment variable in Linux. Term is an environment variable in Linux and the term value of that environment variable decides how the terminal behaves. You saw that earlier there was color coding. Certain things were red, certain things were green, but that was interfering with ability to understand. VT100 is a slightly simpler term. Slightly more old fashioned. It does not understand color. It only knows underline and bright, which is why Madhu suggested change it because red was not readable for you. So, it defines how different programs use their own color. In Linux everything is nicely layered. Vim, the editor I use, does not care, does not know how to talk to a terminal. It will delegate to somebody. That somebody will delegate to somebody else. And that somebody else is what is called a term cap library. And the term cap library looks at, okay, I want to show a nice different color. Can I show? What is your name? VT100. Okay. You are old fashioned idiot. You cannot show, forget it. Vim does not care. So, it built in such nice layers. So, I was changing the, all programs running on this console, their understanding of what colors are supported for programs. I was lying saying it does not support many colors because the colors were causing a difficulty for you to read. Yes. What next? Yes, Ticam. We have a test for them. Yeah, that can wait. That can wait. They need to do two, three things. Starting with waking up, for example. Yes, folks. Any questions? I have some simple rules I implement with some of my students in my programming classes. You ask me a question, then you are entitled to write a test. Otherwise, you are not. I am mightily tempted to implement the same idea. You want to write a test, you have to ask a question which I consider interesting. What is I Python? You will be definitely not considered interesting and won't count. In fact, the number of questions you may have to ask may go up if you ask such inane questions. Yes, you want to finish this class today and write the test. I suggest you start drumming up some good questions fast. Sir, while giving this double underscore in, while checking that if main. Yes. I am getting some error. Any other additions? Getting some error, do something. Any additions? Like I said, if you are getting some error, do something. If you can give me a meaningful interpretation of the error, I might give you an answer. Invalid syntax. Invalid syntax. You are not getting some error. You have made some error. You are either missing a quote. No quotes are missing, sir. No quotes are missing. Are you missing a colon at the end of the year? Whether that name underscore name underscore should be enclosed within colon? No. Quotes. No. Main should be. Main I have enclosed. We have two choices. I can come there and then find the mistake or you can figure it out. What are the chances that you have made a mistake but it is not working? What are the chances? Pretty low, isn't it? It just now worked on the screen. You saw it. Nothing to do is VT100. See, all because of you. Everybody assumes VT100 is some magic. Let me run in a non-VT100 terminal. This is not VT100. You can see the colors, right? There is a space after the if. It takes me half a second to see because I know you have made a mistake. You believe you haven't. That's why it is taking you time. It's not I am super intelligent. I know you have made a mistake because experience teaches me. Chances are very high. Students and people doing make a mistake then compiler suddenly decide to turn wrong. You still believe somewhere I have not done anything. This is me. That's why you are not able to see it. I tell you just repeat to yourself I have made a mistake. You will find out in two seconds. You get it into your system. I am making the mistake. Don't give in to that feeling. I am all right. This bloody computer something is not working. Sir, is there any limit on the number of elements which will be read from the file? No practical limit. There is no fundamental limit. For those of the world, they like numbers with lots of zeros behind them. EVs of data is standard for aerospace. As such, when there is large quantum of elements like 20,000 records are there. 20,000 is not large. Millions? Yes, you are talking large. Millions is large. 20,000 is ideal with 20,000 30,000 and I am an application programmer in a company. Prabhu Ramchandran's of the world deal with millions of data items. As such there is no limitation. Is aerospace guys so you can imagine the number of data he plays around with. No real limitation. When the plot is actually plotted with all such large elements no then the plot will be somewhere no. You need a microscope. Yes, yes. So, will there be any facility or something like that to improve upon the quality of that. They built in viewer. Just you do a plot that what you see there by that is an extremely powerful piece of machinery. You can select a piece, zoom in, you can do all that. That viewer which we are seeing from the morning. The matplotlips default viewer comes with an enormous functionality. But then that zoomed content would be stored in a file? No. That is the problem. So, when we are actually incorporating that zoomed data into a latex compatible version, no then we want some bigger size content. So, you know which area you are zooming. So, you cut that alone plot that subrange alone. This is the language. So, you have to learn to speak this language. So, I want to zoom a part of an image or part of a chart is I have to plot a subset of the original array I plotted. So, you have to start translating and doing things. You can do anything you do in matplot. I mean sorry in matlab almost anything. But you want to do it the same way. So, obviously a different way of doing things. Sir, is there any function available for solving the PDE? There is. JPEG is not a free format. So, by default I do not think matplotlib saves in JPEG. PNG you may have to convert outside from PNG. Please remember that JPEG is encumbered by patents and so on. So, the code is not always clear whether the code is usable for free libraries. Code that handles JPEG. PDEF conversion is there. PDEF is there. You can save into a PDEF image. EPS, PDEF, PS, PNG. Even TIF is there, right Srikant? Even TIF is there. Though TIF is a bit of a beast, not very. Way to specify the shape of O in soil plotting different curves. For example, if you specify O, it will come as solid circles, small circles. Is there any way to specify different shapes? What do you think? Open circles. What do you think? Maybe, but I tried some shape. Some of it shows error. You have a vertical line. You have a horizontal line. You have a thin diamond. You have an X. You have a star, a pentagon, square, triangle right, triangle left, triangle up, triangle down, circle, pixel. So, plot will tell you which are the legal plotting characters. In ODNT, can we give our desired method? Because different methods will have different rate of convergence. ODNT actually is not a single method. It uses an internal library of methods and you can specify, but you are unlikely to beat its intelligence. This is all coming from the days of Fortran. So, this has been tested for 40 plus years. You are unlikely to improve on it unless you are solving a particular problem where your expertise is much, much more and you know for this particular peculiar problem, a particular method will work well. On average, you are very unlikely to beat the built-in algorithm. Like I said, these are old Fortran code wrapped around. So, it is not actually internally you are calling old Fortran code from inside Python. So, that is tested for 40 plus years. So, it is unlikely to be improved for efficiency unless, like I said, you have very specific domain where you have lot more data. Even there, I do not know. It is a bit of a specific area. Prabhu and his friends have written a generalized solver where they plug in the visualization toolkit where they plug in the choice. It could be Euler, it could be Rungekutta, it could be what is that Rungekutta 4, 5 and all the other methods. So, it is not difficult to write. Please remember passing a function as a argument is styles play in Python. So, it is happening internally. It is calling different functions. I have a feeling you can specify also. Just look at from scipy.integrate import odint and do odint question mark and check. It should tell you whether other things are possible. See or any other means turbo see I have used that I want to find the particular function is you by default it is a if it is default function is it is defined some header file. It is like math.hpo download. Like here we use some plot line space. Sometimes it is belongs to psi lab. Sometimes it belongs to pi lab. So, how I find I will find that plot is belongs to psi lab or belongs to means because I need to import scipy and import pi lab. You do not start with the function. You do not start by I need to I need a function plot. Where is it available? You do not start there. You start by I want to plot a chart. So, where is the functionality available? Then you look at in that module what are the exported symbols. You never start with a function name and start wondering which module it is available from. That is not how it happens. You have raised your question in that fashion, but you rarely start there. Like we have used today and line space and we used it. Why? We know we started by saying we want to plot and for plotting we need certain of these functionalities. That is all. In my given situation you are not likely to I have this function. I do not know what to do with it. You will never be in that situation. You will say I want to do X. How to do X? Then when you look it up you will normally see all documentation will refer to both. Because when I use plot and the question market gives that it has something pi lab and dot lab. But for line space I have search is there is no such implements. Saying it is in sci-fi. That is right. You are checking whether I am giving a wrong answer. No sir. Before. Before questioning you. I understand. See that is what. I will only repeat what I said. You are rarely going to be, this is the classroom situation where you know these two functions. So you are looking for it. But in a new setup you are unlikely to start with a function name or not know anything about it. In which case of course Google is there to find out. Python documentation is extremely good. Python is one of the better documented languages. The problem is Python standard library is well documented. The problem you are describing is you do not know which library to look for. So yes. In raw terms that looks like a difficult problem. In reality it rarely happens that way. Because almost any Google search will turn up which package it belongs to. Yes sir. So my question is as the Python is object oriented language. So how is it is going to handle the objects and the memory management? When you find out do me a favor don't tell me. I don't even want to know. It works. Python is a language intended to write replication systems. It is a language designer's questions outside my area of specialty. Thank you. Sir object attributes starting with double underscore. Does it have any special meaning? It has a special meaning that they are not to be used. They are for the internal purpose of the module. So private attributes. No such dirty word in Python. There is nothing private. But this says the writer of the module intends this to be used internally and expects you will behave responsibly by not using it. But he will treat you like an adult and leave it there. Not treat you like a child and say if you use it there will be a syntax error which is the private way of doing it. There is no private public in Python. The word object oriented is very heavily overloaded. So that's another reason I don't want to go into the discussion of becomes a question about object orientation. How it handles? Python's object orientation is very different from the C++ Java model. C++ Java model of object orientation there is nothing special about it. But that's the only one many people know. So everybody thinks another model of object orientation is either wrong or insufficient. So it will become a too bigger discussion. In reality the C++ Java model of object orientation is very deficient. It's nowhere near half good. If you are interested, tomorrow we will allocate some 10-15 minutes for discussing that. I would expect you to remain me. I won't start. But that's a very rather bruising debate. What is object orientation? Yes, somebody else is raising his hand in between. Next question, only this side is talking so far. And even that too some selected audience. We can all have a private discussion in the guest house later. If I am going to talk to only these 3-4 people I can do it later. So in C we have structure. Is there any form like structure in Python? Depending on what you want to do you could achieve the same thing with a list. List are heterogeneous, structures are heterogeneous. But remember Python is dynamically typed and there is and it is rather weakly typed language. So a structure consists of two strings followed by an integer. I can't enforce it. In C if I say that is the structure then I initialize the structure from values. The typing will ensure that some amount of compatibility with the string string int is maintained. Even that I can't do in Python. So you can do it with lists is a faking answer actually. The correct way to do it would be with classes as objects. Sir while importing say for example I am importing plot function a number of times in my program sir. Import only once. No sir I am using plot function many times. With the import can I like say pi lab like say instead of star I can use plot function. So instead of star you can import specific functions. So that we can reuse that. So that you can misuse that is for better description. You can say from psi pi or from pi lab import plot which allows bring plot into the current namespace. So there is no need to say pi lab dot plot every time. But you can say you know what I only beat one person. I didn't beat everybody. Whether it is better behavior or not is open to question. If you consider beating up other beating up people bad behavior whether there is some mitigation available because you beat up only one person as opposed to everybody is all the difference. But it will save time when you are reusing that same function. It saves time when you are typing yes. Yeah typing. I prefer to think that typing is the least of my bothers. Hello sir after declaration the array A1 is equal to array and we declared it something. And exactly below that we declared the A1 hash one manner D. Sir I don't understand the one minus D. What is one manner D? Didn't we talk about hash being a common character? Let me take five minutes. I will talk about one feature of Python. Then I will hand you over to Srikant. Let's say you have a function. Doesn't matter what it is in. And you want to check a variable between different invocations. In other words whenever this function is invoked that variable must change its value. How do you do that? In C you would do a static variable inside a function. So how do you do it in a language like Python? In C static variables are the answer. Inside a function you define a variable static. So first time it has a value. So it has a value which is initialized at compile time which is what happens to static variables. Their value is assigned at compile time as opposed to run time. And you can increment it. It will retain the value between successive invocations as opposed to other variables which are allocated on the stack so that every time they are initialized these values will retain. So far based on what you have seen how do you retain a value? So how will you increment it inside a function? It is a global variable. How do you guarantee only from inside that function it is incremented? Python functions are first class objects. You can create a variable f dot v where f is a function. So that variable is defined in the context of that function. You can check for its existence. You can increment its value. You can do all sorts of things. So the code concession and power that you get from this is extraordinary. I can also check whether the variable exists. How do I do that? If it does not exist because the function is never called there is no compile time. So unlike a static variable I cannot rely on the fact that the variable has been defined and it has a value. So I can do something like wrap in an exception essentially in a try catch. Now this will throw an exception because f dot v does not exist. You can catch it and then define it there and assign the values here. Or I can even do this. Now this will throw an exception because f dot v does not exist. So which is why it is very difficult to answer the question how object oriented python is. You are used to thinking of an object as data with methods attached. Here there is a method with data attached. Now is it an object? It is a method with data attached to it. And this v does not exist outside cannot be referenced as anything other than f dot v. I can refer to it anywhere. It is as global as f wherever f is visible f dot v is visible. But remember traditionally the notation f dot v is object member. Here f is a function and v is a value. It could be q, it could be Ashokan. The question was is anything special about v? No it could be any variable. Yeah I should have made that much clearer. Thanks. We can attach anything. I can attach two variables. There is nothing magical about one variable. I can have f dot p and f dot q also. Like I said the only caveat is unlike c static variables where I can rely on the compiler to guarantee existence. In the beginning of the run time I have to do the try catch. I hope that gave you a glimpse into some of the powerful things python as a language can do. None of this is interesting to someone who is going to use it as a plot as a computational toolkit. But since a significant number of you are computer science people you may want to look at the language in a different light. It is probably one of the better designed languages of recent times. It has a high functional component. It is methodology or rather methodology agnostic. It does not take a strong view about object orientation or imperative or functional style. It is style agnostic. You could write in any style. Did we do Armstrong numbers by any chance Shrikan? No. Not even discussed there. No problem of that type. Fine. Maybe tomorrow we will spend some time writing some code. At that time we will discuss this issue of different programming styles. What is a classic imperative or a procedural style? What are the other styles and why we talk about python as a multi-paradigm language? You could write code in any of these styles with equal facility. It is not geared towards writing one type of code. You could write excellent well-structured beautiful procedural programs. It is difficult to write convoluted programs in python. It can be done. You could write well-crafted objects. You could also write very nice functional code. If you are not used to seeing functional code the first time I hope like this understanding functional style of programming would be equally interesting tomorrow. Thanks a lot for your patience. I hope to indulge and impose on your patience tomorrow also. See you tomorrow.