Python Programming Language
Python is an interpreted, general purpose language. An interpreted language is a language that needs to be interpreted by an interpreter. The program codes written using an interpreted language are supposed to be executed using an interpreter. The interpreter performs various functions. For example, the interpreter executes the source of the programming language directly. So, the interpreter translates the source code into a code that can be understood by the user. In addition, python is a high level programming language .The design philosophy of python enforces code readability. Python is aimed at combining remarkable power with a clear syntax. The standard library of python is large and comprehensive. Python is different from other languages.
For example, python’s use of indentations for block delimiter is unique from other languages like C, C++ and Java and Pascal. Python supports different programming paradigms. For example, python supports object oriented programming and functional programming paradigm. Python features are full dynamic type system and automatic memory management like Perl. Python is a dynamic language. Like other dynamic programming languages, it can be used as a scripting language. On the other hand, python can be used in various non scripting activities. The reference implementation of python is free and open source software. The python interpreters can be used in different operating systems. This makes it easy for the users to understand the language. Most of the python programs can be compiled into stand alone executable codes for various systems. This paper analyzes python language, its history and advantages and disadvantages of using python language and its uses.
History of python
Python was developed in late 1980s and was first implemented in 1989 by Guido Van Rossum. Guido first implemented the language at CWI in Netherlands. The language was developed to replace ABC programming language. ABC is considered an imperative general purpose programming language and programming environment. The language was first developed at CWI Netherlands by Leo Geurts and other developers. The language was developed to replace BASIC and pascal.Van Rossum is the main developer of the python programming language, hence the title “benevolent doctor of life”. After several years, python 2.0 was released. Python 2.0 was released on 16th October 2000.Python 2.0 had more advanced features than python one.
For example, python2.0 had a garbage collector. In computer science, a garbage collector is a kind of automatic memory management. It is also considered to be a resource management where by the memory is managed. A garbage collector helps reclaim memory that is being used by objects that are no longer being used by the program. So, python2.0 was able to reclaim memory that was being used by objects that were not being used by the program unlike the first version of python. This made it easy to utilize the memory well. In addition, python 2.0 had a Unicode. A Unicode is standard used in computing industry that ensures consistent encoding of text and also representation. The Unicode makes it easy for the program to handle different texts that are expressed in different writing systems. Python 3.0 was released on 3rd December 2008.The program was considered in compatible. Most of the features of python 3.0 have taken from python 2.6 and 2.7 and modified (Ranum &Miller, 2006).
Important Language Features
Python programming language is a multi paradigm programming language. Python programming language allows users to use various styles when programming. For instance, python allows users to use object oriented programming style. It also allows users to use structured programming style. The object oriented programming and structured programming styles are supported fully by various features of the python programming language. In addition, there are various features that support functional programming and aspect oriented programming. Other styles supported are Meta programming and magic programming. The various styles have made it easy for users to use different programming styles in their work. This has in turn made python programming language flexible. There are other styles that are supported using extensions. For example, the styles are supported using extensions like pyDBC and contracts. Contracts in python allow “design by contract”. The support for multiple paradigms has made python more powerful than other programming languages(Surhone, Timpledon &Marseken, 2009).
Moreover, python programming language uses dynamic typing. A programming language is considered to be dynamically typed if most of its type checking is performed at run time, but not compile time. Most languages which are not dynamically typed have most of their type checking performed at the compile time. In dynamic typing, values always have types and variables do not have types. In dynamic typing, a variable can refer to a value of any type. Dynamic typing is more flexible compared to static typing. This is because dynamic typed languages allow programs to generate types and functionality according to the run time data. Although dynamic typing makes a language flexible, it may result to runtime type errors. For instance, at run time, a value may have a type that is not expected. This in turn leads to runtime type error as the right operation is not applied. The operation can occur long after the place where the programming errors occurred. This is mostly where the wrong type of data may have passed where was not supposed to pass. Pythons use various things to manage memory. For instance, it uses reference counting and cycle detecting garbage collector to manage memory (Surhone, Timpledon &Marseken, 2009).
Python unlike other languages has a dynamic name resolution. The dynamic name resolution binds methods and variable names when a program is being executed. Python is high extensible unlike other languages. For instance, the new in built codes in python can be written using other languages like C, C++ and Cython. Hence, the user is capable of modifying the code to fit his or her needs. In addition, python can be used as an extension language. The language can be used to modify modules and applications that require a programmable interface. The structure of python language offers limited support for functional programming using Lisp (Surhone, Timpledon &Marseken, 2009).
Like other programming languages, python has several elements that make it easy for programmers to write programs. For instance, python has variables, modules and statements. The most important feature of python language is the use of elegant syntax. The syntax allows the user to read the code of a program easily. This in turn makes it easy to use the language for prototype development and ad hoc programming activities (Book &LLC, 2010).
Python has an in built development environment known as the IDLE. The IDLE offers a huge standard library that supports various programming activities like connecting to a web server and searching text using regular expressions. It also allows the user to read and modify files. Also, python has modules. The python modules are important as they allow the user to split his or her program into modules. The python modules are of different types. For example, there are simple modules used by beginners learning python languages. These kinds of modules make it easy for the beginners to understand the language. Additionally, there are other modules that provide interfaces to graphical user interface. A python language has also variables. The variables in python are written different from variables in other languages like PHP and Perl. For example, the variables do not have a ($) dollar sign before them like in PHP. The variables are stated using simple text.
For example, height=23.Python supports other elements like strings, expressions and control statements. The statements used in python language are similar to the statements used in other languages. For example, the language uses “if statement” and “for statement”. It also uses “while statement”. The statements play various roles when executing a program. Other statements include “try statement”. The “try statement” allows an exception that is raised in the code to be caught by the “except clause” in the program. Another statement is the “class statement” that executes a bock of code. It also attaches the namespace to a class so that it can be used in object oriented programming. The expressions used in Python language are similar to the expressions used in C language and java language. The / operator in python 2 operates on integers and gives the results in form of an integer. The / operator in python 3 does not give the results as integers, but it gives the results as a float. In python 3, the operation // is used to carry out integer division. Users can enable the division operation in python 2 using the statement “from __future__ import division” (Book &LLC, 2010).
Python has various kinds of strings and they are quoted using a single quote or a double quote. Python has inbuilt types like “bytes”, “list “and “tuples”. Others include “str” and “list”. The types have different functions. For example, a string in python abbreviated as STR is a sequence of characters. A list type can have a mixture of other types like string and a Boolean type abbreviated as “bool”. Python has methods. Methods are functions that are linked to the object class. The syntax for methods in python are “instance. Method (argument)” and class. method (instance, argument).The python methods have a “self” parameter that allows them to access instance data in contrast to other object oriented programming languages like Java and C++ (Book &LLC, 2010).
In conclusion, python programming language has unique characteristics from other programming languages For instance; the python programming language supports multiple styles. Python supports object orientated programming and structural programming. This has made it easy for the language to be used in web design and development of various applications. The language can be used in scripting. The language is also easy to learn as it has in built modules that make it easy for the learner to understand. Like other programming languages, python has various elements like variables, control statements and types.
Book,.&LLC.(2010).Python Programming Language: Python, Python Syntax and Semantics, Mobile Development, History of Python, List of Python Software, Eclipse.General Books LLC
Surhone, L.M., Timpledon, M.T., &Marseken, S.F.(2009).Python (programming Language): High-level Programming Language, List of Python Software, Comparison of Integrated Development Environments.Betascript Publishers
Ranum, D.L., &Miller, B.N.(2006).Computer Science: The Python Programming Language.Jones & Bartlett Learning