Welcome to the lecture of Introduction to Python. In this lecture, we are going to see a brief history of Python and how does the programming environment of Python look and how does the coding environment look as such. And we are also going to see what are the integrated development environment that are available along with Python. Now, looking into the evolution of Python, Python was developed by Guido Raan Rossum in the late 80s and it was developed at the National Research Institute for Mathematics and Computer Science and this was at Netherlands.
And since then, there has been three major version changes in Python, Python 3 being the latest and the current or the latest version of Python is version 3.8. Now, let us look at Python as a programming language. So, Python supports multiple programming paradigm like functional, structural and OOPs.
It's also dynamically typed which means that it checks for type safety during runtime. Now type safety is the extent to which Python would prevent type based errors. So, type based errors are undesirable program behavior and they are caused by discrepancy between different data types for your constants, variables or functions or methods.
Python handles these type-based errors really well because it is dynamically typed. Python also de-allocates objects which are not used for long and Python is also dynamically binded. It's also called late binding and these are methods which are looked up by name during runtime.
Python's design is guided by the 20 aphorisms. It is described as the Zen of Python by Tim Peters. So these are rules that are used to design the entire structure of Python.
And these are very simple rules and they are given on the website. So, some of the aphorisms are simple is better than complex, complex is better than complicated. Now, there are in total 19 aphorisms and Tim Peter has left the 20th aphorism to Guido van Rossum, the founder. Python uses the standard CPython interpreter and it is managed by the Python Software Foundation. There are also other interpreters namely JPython for Java, INpython for C sharp.
and a couple of others. The standard libraries are also written in Python itself and Python offers very high standards of readability. Python offers support across all platforms being Linux, Windows and Mac and the Python community is very large and they keep contributing a lot towards the group and Python as such is very very adept at handling errors and we'll see more of these aspects as we go towards the course.
Now when you compare Java and Python, Java is statically typed which means all type safety checks is done during compilation. It's also called static compilation. Because of this reason, the time which you would require to develop a code in Java is more.
But in contrast, Python is dynamically typed which means all type safety checks are done during runtime. Now, this will also compensate for the huge compilation time when you compare it with Java. Also, codes which are dynamically typed. are less verbose in nature and they offer more readability. So this is one important advantage of Python over Java.
Python has several features that make it very very well suited for data science and by features I am referring to the libraries and the other tools which are specifically designed for data science tasks. Python was developed under the open source initiative license which means it's free to use and to be even distributed commercially. Now the syntax which is used in Python is very simple to code and understand and this makes it very very beginner friendly and for those of you who are starting out to use Python, I think the learning curve is going to be very short.
Now Python also combines really well with majority of the cloud platform services thereby making it a good tool for even big data. Now let's look at the coding environment. Now, in general, any software program can be written using a terminal, a command prompt, a text editor or through an integrated development environment. So, every program needs to be saved with an appropriate extension and it has to be executed in the corresponding environment.
Now, if you take a look at the integrated development environment, it is basically a tool or a software product which is solely developed for the purpose of supporting software development and this is for various programming languages. So, towards the end of this lecture, we are also going to be seeing what are the available integrated development environment for Python. So, support for Python version 2 will be available till 2020 and So, post 2020 support will be maintained for version 3.6 onwards. Now, you can install the basic version of Python from their website.
I have linked up the name of the website here and before downloading if you go to the website, you will also see that they offer a terminal where you can type in basic commands like print statement or you know assigning a value to a variable and look at basic conditional operations. So, we are going to be looking into a few of them now. I just have a small screenshot.
I'm going to be zooming in to show you what are the different lines of commands that we have typed. So I have a small statement that says hello world and this is a string. So print is used to print a statement. Now I have assigned a value of 5 to a variable called my variable.
So now my variable is the name of the variable and in the next line you will see that I have added 8 to my variable. and I'm saving it onto B. In the previous line, you'll also see that I have ended the statement with a semicolon.
Now, this is not required, but it's okay to do it because Python does not explicitly expect you to end a line. So, you can also try out the other statements that is given here. Now, let's say I'm assigning a value of test. This is a string to a variable D.
If you just do type of D, you get the data type of the object. Now the object here is the variable. Since this is a string, the data type is displayed as string. So now let's look at what integrated development environments are. Now I've abbreviated it as IDE.
Now like I earlier said, an IDE is a software application. It gives you a cohesive set of tools and that's required for the software development. The idea of having such an IDE is to basically simplify software development.
So, Python offers coding only from the terminal. Now, if you are not comfortable using the terminal, you can move on to these integrated development environments. So, these IDEs give you better GUI and they also provide you tools for managing, compiling, deploying and debugging softwares, right.
So, IDEs provide you a great interface if you are starting out with Python and they are more easy to understand and interpret compared to a terminal based coding. A typical IDE should definitely comprise of a source code editor, a compiler and a debugger. Additional features can also include syntax and error highlighting and code completion.
Now they offer support in terms of building and executing the program along with debugging the code from within the environment. So these are some of the features an IDE should definitely comprise of but additional features that would be good to have are syntax and error highlighting and code completion. Also, some of the best IDEs provide version control features.
Now, you have Sublime Text and Atom. These are text editors and they are general IDEs with Python support. But apart from these, if you look at PyCharm, Jupyter or Spyder or Thony, these are specific editors which are developed for the purpose of Python.
Now, PyCharm and Spyder dedicatedly use Python. Jupyter provides you Julia, Python, R and they also now provide Scala. So let's look at the first IDE for Python which is spider.
Now spider is supported across all OS platforms. They are available as an open source version. So they either come tagged in with an Anaconda distribution which you can install from their Anaconda website or you can also install them separately. So after you install Python in your systems, you can just do a pip install spider to install spider in your systems or you can just directly go to the Anaconda website and just Download the Anaconda setup.
Now Anaconda setups consists of lot of IDEs. They provide Jupyter, R, Spyder, PyCharm and along with several other IDEs. But again, it comes under one roof. So it's more easier to work with.
And Spyder is specifically developed for Python and for data science. And its features include a code editor with a robust syntax and error highlighting. It also offers code completion, navigation, debugging and an integrated document.
Now if you look at the interface of spider you will see that its interface is very very similar to MATLAB and R. So let's look at Python now. It's again supported across all OS platforms.
It's available as a professional version or a community version. The professional version is a paid version whereas the community one is a free open source. It supports only Python and can be installed separately or through Anaconda. And its features include a code editor, with robust syntax and error highlighting facilities and it also provides you code completion, navigation and debugging, version control and unit testing. And this is the environment of PyCharm.
It's more suited for those who are from a development platform because its environment and interface is a little complex to understand but it again proves a great tool for the field of data science. So the last IDE that we are going to look into is the Jupyter Notebook. Now this is very different from the other two IDEs that we've earlier seen which is Spider and PyCharm. Now Jupyter Notebook is a web app.
It basically allows you to create and manipulate documents which are called notebooks. So, it is again supported across all OS platforms and is available as an open source version. So, this is a small snippet of Jupyter that I have taken from their website and you can see that it consists of an ordered collection of input and output cells. Now, these cells can contain anything, they can contain codes, text or plots.
Now, because these cells can also contain text, they are very very narrative and descriptive in nature. And this makes the understanding even more better because it also allows you to share the codes and narrative text through formats like PDF and HTML. And it's basically used for education and presentation tools because of its nature, because it's very descriptive and narrative in nature. And that makes it very, very good for these fields. But it lacks most of the features of a good IDE.
But then it makes it up by, you know, allowing you to add these text and plot in cells. And you can also play around with these plots. Let's say if you have a plot where you have to tune a few parameters, then you can also use those parameters to tune and see how does the graph change. Now, Jupyter also comes in bundled with Anaconda or you can install it separately. Now, like I earlier said, Jupyter actually stands for Julia, Python and R.
And it also supports Scala now, but they've not incorporated it into the name. So, these are notebooks basically you are just dealing with only one set of documents where you can add your text, you can add your code, your plots and all of these are under one script. Now, that brings us to the question there are so many IDEs available, how do I choose about what works for me? Now to know which IDE works really well for you, it's entirely based on requirements. Now you need to work with different IDEs to first identify what your requirements are.
For someone, a narrative text along with the code would be better. But for someone, a good GUI is all that matters, right? So, in order for you to understand what works for you, you need to first go on, explore, try out different IDEs.
And this will also help you identify your own requirements, right? So, in order to, there's nothing like a good IDE or a bad IDE. Every IDE is very, very different in nature.
And it's... It's all based on your requirements and what you are comfortable working with. Thank you. We'll meet you in the next lecture.