FEATURES OF PYTHON
In this tutorial, we are going to learn about the history and features of python in terms of usability and programming options
I am glad you have found this article, now it’s high time to get yourself started with Python Programming and know in depth about the features and its applications in the industry. We will also be looking at python’s major frameworks like Django, Flask and Pyramid and micro frameworks like bottle etc.
It’s not magic that so many people want to learn python and want to start in their programming careers by selecting python as the primary language. It is because of python’s simple and accessible nature that everyone wants to learn python because of its features.
So, let’s start by talking about the topics we are going to cover in this article:
History
What is Python?
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python’s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.
Python can be easy to pick up whether you’re a first time programmer or you’re experienced with other languages.
Why is it called Python?
A Dutch programmer named Guido van Rossum made Python in 1991. He named it after the television show Monty Python’s Flying Circus.
What makes Python so unique and powerful?
Python’s strongest assets is its extensive set of libraries. These libraries can make it easier for developers to perform complex machine learning or statistical analysis tasks without having to rewrite many lines of code. Some of the most popular libraries include tools for data manipulation and visualization (NumPy, SciPy, and matplotlib), data mining and Natural Language Processing (Pattern, NLTK). Perhaps unsurprisingly, Python is the language of choice for organizations with data-heavy workflows, from YouTube to the New York Stock Exchange to the National Web Service.
Architecture
Python receives and flows data in three steps:
Parser
Text parsing is a common programming task that splits the given sequence of characters or values (text) into smaller parts based on some rules. It has been used in a wide variety of applications ranging from simple fileparsing to large scale natural language processing.
Compiler
A compiler in Python processes statements written in a particular programming language and turns them into machine language or “code” that a computer’s processor uses.
Interpreter
An interpreter is a program that reads and executes code. This includes source code, pre-compiled code, and scripts.
Build
Functions
Functions are a construct to structure programs. They are known in most programming languages, sometimes also called subroutines or procedures. Functions are used to utilize code in more than one place in a program. The only way without functions to reuse code consists in copying the code.
A function in Python is defined by a def statement. The general syntax looks like this:
def function-name(Parameter list): statements, i.e. the function body
Classes
Python is an “object-oriented programming language.” This means that almost all the code is implemented using a special construct called classes. Programmers use classes to keep related things together. This is done using the keyword “class,” which is a grouping of object-oriented constructs.
To create a class, use the keyword class
:
class MyClass: x = 5
Modules
A module allows you to logically organize your Python code. Grouping related code into a module makes the code easier to understand and use. A module is a Python object with arbitrarily named attributes that you can bind and reference.
Simply, a module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code.
Packages
Suppose you have developed a very large application that includes many modules. As the number of modules grows, it becomes difficult to keep track of them all if they are dumped into one location. This is particularly so if they have similar names or functionality. You might wish for a means of grouping and organizing them.
Packages allow for a hierarchical structuring of the module namespace using dot notation. In the same way that modules help avoid collisions between global variable names, packages help avoid collisions between module names.
Lists
A list is a collection which is ordered and changeable. In Python lists are written with square brackets. Create a List:
thislist = ["apple", "banana", "cherry"] print(thislist)
Tuple
A tuple is a collection which is ordered and unchangeable. In Python tuples are written with round brackets. Create a Tuple:
thistuple = ("apple", "banana", "cherry") print(thistuple)
Dictionary
A dictionary is a collection which is unordered, changeable and indexed. In Python dictionaries are written with curly brackets, and they have keys and values. You can create a dictionary too:
cars = { "brand": "Ford", "model": "Mustang", "year": 1964 } print(cars)
Features of Python
Easy To Learn
Python is easy to learn and use. It is developer-friendly and high level programming language.
Easily Interpreted
Python is an interpreted language i.e. interpreter executes the code line by line at a time. This makes debugging easy and thus suitable for beginners.
Cross-Platform
Python can run equally on different platforms such as Windows, Linux, Unix and Macintosh etc. So, we can say that Python is a portable language.
Free and Open Source
Python language is freely available at python.org. The source-code is also available. Therefore it is open source.
Object Oriented
Python supports object oriented language and concepts of classes and objects come into existence.
Large Library
Python has a large and broad library and provides rich set of module and functions for rapid application development.
GUI Programming
Graphical user interfaces can be developed using Python.
Extensible
It implies that other languages such as C/C++ can be used to compile the code and thus it can be used further in our python code.
Features of Python: Python Frameworks
Django
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.
Flask
Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions.
Pyramid
Pyramid is a lightweight Python web framework aimed at taking small web apps into big web apps.
Tornado
Tornado is a scalable, non-blocking web server and web application framework written in Python. It was developed for use by FriendFeed; the company was acquired by Facebook in 2009 and Tornado was open-sourced soon after.
Bottle
Bottle is a WSGI micro web-framework for the Python programming language. It is designed to be fast, simple and lightweight, and is distributed as a single file module with no dependencies other than the Python Standard Library.
WEB2PY
Web2py is an open-source web application framework written in the Python programming language. Web2py allows web developers to program dynamic web content using Python.
Numpy
NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.
Scipy
SciPy is a free and open-source Python library used for scientific computing and technical computing. SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, ODE solvers and other tasks common in science and engineering.
Pylons
Pylons Project is an open-source organization that develops a set of web application technologies written in Python.
Conclusion
In this tutorial, we have learned about the history and features of python in depth and saw different frameworks that work differently for each task.