Skip to main content

Learning Python part -2: Intro to Python


Python is high-level, general-purpose programming language. It was developed by Mr. Guido van Rossum and first released in 1991. Python supports multiple programming paradigms, including procedural, object-oriented, and functional programming. Python was conceived in the late 1980s as a successor to the ABC language. Python 2.0 got released in 2000. This release introduced features like list comprehensions and a garbage collection system. Python 3.0 was released in 2008 and it is considered to be a major revision of the language. Due to this Python 3 is not fully backward-compatible. Most of the Python 2 code requires modification prior to running it on Python 3. Python 2.7.x, was officially discontinued in January 2020.
Python emphasises code readability as it is meant to be an easily readable language. Code formatting in Python is visually uncluttered, and it often uses English keywords where other languages use punctuation. Python aims to help programmers write clear, logical code for small as well as large-scale projects.
Core philosophy of Python language is summarised in the document The Zen of Python as: You can also see by running "import this" command (without qoutes) on your python terminal.

Beautiful is better than ugly. 
Explicit is better than implicit. 
Simple is better than complex. 
Complex is better than complicated. 
Flat is better than nested. 
Sparse is better than dense. 
Readability counts.
Special cases aren't special enough to break the rules. 
Although practicality beats purity. Errors should never pass silently. 
Unless explicitly silenced. 
In the face of ambiguity, refuse the temptation to guess. 
There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. 
Now is better than never. 
Although never is often better than *right* now. 
If the implementation is hard to explain, it's a bad idea. 
If the implementation is easy to explain, it may be a good idea. 
Namespaces are one honking great idea -- let's do more of those!

Python is often described as a "batteries included" language due to its comprehensive standard library. Python does not include full functionality in its core. Rather Python is designed to be extensible with the help of its comprehensive standard library. Python is also is known as "garbage collected" and dynamically typed language. The term garbage collection refers to the automatic memory management. That simply means, object that are stored in memory, if they are deleted, memory reclamation is initiated automatically.
Some of the use case domains where python is used extensively:

  • Scripting
  • Machine Learning
  • Artificial Inteligence
  • Information security
  • GUI Applications (like Tkinter )
  • Web frameworks like Django 
  • Web scraping (like Selenium)
  • Test frameworks
  • Multimedia
  • Scientific computing
  • Text processing and many more..


Popular posts from this blog

Learning Python Part-6: Python Comments

When it comes to writing a python program, based on the requirements, programs can simple programs of limited number of  lines or it can be really large program which might even span multiple python modules. Now the point here is that, even if we know how to write the program and even we follow correct concepts and syntaxes while writing program, we cannot keep it in our mind forever. We cannot remember each and everything about the program like variables, classes, concepts, functions and so on after some period of time. If the program written by us at some point in time back, once we open it after a period of time, it should not be a situation that we are blank, or guessing why particular code, function and so on. Even it may happen that you are working in a team and program code writing tasks might be shared. So when you put all pieces together written by multiple programmers in your team, you should be able to understand the code. This is where we bring in the concepts of

Learning Python Part-4: Python Keywords

Python has a set of keywords that are reserved words that cannot be used as variable names, function names, or any other identifiers They are used to define the syntax and structure of the Python language. In Python, keywords are case sensitive. There are 33 keywords in Python 3.7.  All the keywords (except True, False and None) are in lowercase. Below is the list of keywords in Python 3.7 I will not be using just syntax to explain these keywords, rather I will use some simple yet enough code examples considering new plus experienced people. For those who are new to python, if you find it difficult  to understand the complete code, just try to see the context and usage of keyword.  False :  This keyword is used to represent a boolean false. If a statement is false, “False” is printed. False in python equals to 0. True: This keyword is used to represent a boolean true. If a statement is true, “True” is printed. True in python equals to 1. None:

Learning Python - Part-5: Python Interfaces

When it comes to working with python, we can always use interactive mode by launching python  or Python3 command as shown in below screenshot.  Image: 1 Once launched we can run all sorts of python operations, however, this approach is not used for development work.  When it comes to writing programs, we generally prefer editors. In fact we can use basic editors like notepad(Windows)/vi editors(Linux). In these editors, once we are done with writing programs, we need to make sure files are stored as .py extension ( Image: 2 ). We simply run python command to execute the programs as shown in below screenshot ( Image: 3 ). Image: 2 Image: 3 Though using normal editors is fine, but when it comes to writing simple, large or complex programs, these basic editors do not offer help or suggestions or correction while writing code. That is where the need of tools that help during programming arises. Below are some of the code editors and IDEs that are widely used.