python features

By | March 1, 2019

Python Features-:  We know that the Python is a general purpose, dynamic, high level and interpreted programming language. It support Object Oriented programming approach to develop applications.

Python is a modern programming language developed by Guido van Rossum in the 1991  (and named after a famous comedic troupe). Although Python isn’t perfect for every application, its strengths make it a good choice for many situations.

Python is easy to use-: Programmers familiar with traditional languages will find it easy to learn Python. All of the familiar constructs—loops, conditional statements, arrays, and so forth—are included, but many are easier to use in Python. Here are a few of the reasons why

  • Types are associated with objects, not variables. A variable can be assigned a value of any type, and a list can contain objects of many types. This also means that type casting usually isn’t necessary and that our code isn’t locked into the straitjacket of pre-declared types.
  • Python typically operates at a much higher level of abstraction. This is partly the result of the way the language is built and partly the result of an extensive standard code library that comes with the Python distribution. A program to download a web page can be written in two or three lines.
  • Syntax rules are very simple. Although becoming an expert Pythonista takes time and effort, even beginners can absorb enough Python syntax to write useful code quickly.

Python is well suited for rapid application development. It isn’t unusual for coding an application in Python to take one-fifth the time it would in C or Java and to take as little as one-fifth the number of lines of the equivalent C program. This depends on the particular application,  for a numerical algorithm performing mostly integer arithmetic in for loops, there would be much less of a productivity gain. For the average application, the productivity gain can be significant.

Python is expressive-: Python is a very expressive language. Expressive in this context means that a single line of Python code can do more than a single line of code in most other languages. The advantages of a more expressive language are obvious. The fewer lines of code we have to write, the faster we can complete the project. The fewer lines of code there are, the easier the program will be to maintain and debug.Like  consider swapping the values of two variables, var1 and var2.

var2, var1 = var1, var2

Python Is Readable -: Another advantage of Python is that it’s easy to read. we might think that a programming language needs to be read only by a computer  but humans have to read our code as well. whoever debugs our code.whoever maintains our code  and whoever might want to modify our code in the future. In all of those situations, the easier the code is to read and understand, the better it is.

Python’s main advantage in this department is its use of indentation. Unlike most languages, Python insists that blocks of code be indented. Although this strikes some people as odd, it has the benefit that our code is always formatted in a very easy-to-read style.

example -: one written in Perl and another one in Python. Both take two equal-size lists of numbers and return the pairwise sum of those lists. I think the Python code is more readable than the Perl code…

# Perl version.
sub pairwise_sum {
my($arg1, $arg2) = @_;
my @result;
for(0 .. $#$arg1) {
push(@result, $arg1->[$_] + $arg2->[$_]);
}
return(\@result);
}

# Python version.
def pairwise_sum(list1, list2):
result = []
for i in range(len(list1)):
result.append(list1[i] + list2[i])
return result

Python is completed-: Another advantage of Python is its “batteries included” philosophy when it comes to libraries. The idea is that when we install Python, we should have everything we need to do real work without the need to install additional libraries. This is why the Python standard library comes with modules for handling email, web pages, databases, operating-system calls, GUI development, and many more as like

import http.server
http.server.test(HandlerClass=http.server.SimpleHTTPRequestHandler)

Python is cross-platform-: Python is a cross-platform  language. Python runs on many platforms as like  Windows, Mac, Linux, UNIX, etc.It is an interpreted language that  the same code can run on any platform that has a Python interpreter, and almost all current platforms have one. There are even versions of Python that run on Java (Jython) and .NET (IronPython), giving us even more possible platforms that run Python

Python is free-: Python is also free. Python was originally and continues to be developed under the open source model and it is freely available. We can download and install practically any version of Python and use it to develop software for commercial or personal applications and we don’t need to pay for  it.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *