Introduction of python in hindi by unitdiploma

•Features of Python

•Applications & Flavour of Python

•Difference between C and Python

•Difference between Java and Python

•Byte Code

•Memory Management in Python

•Garbage Collection in Python

Introduction

  • Python is a popular programming language.
  • It was created by Guido van Rossum, and released in 1991.
  • The name “Python” was adopted from the Rossum’s favourite comedy series “Monty Python’s Flying Circus”.
  • Python is mainly interpreted language.
  • It is used for web development (server-side), software development, mathematics, system scripting etc.
  • In 1994, Python 1.0 was released with new features like lambda, map, filter, and reduce.
  • Python 2.0 added new features such as list comprehensions, garbage collection systems.
  • On December 3, 2008, Python 3.0 (also called “Py3K”) was released. It was designed to rectify the fundamental flaw of the language.
  • ABC programming language is said to be the predecessor of Python language, which was capable of Exception Handling and interfacing with the Amoeba Operating System.  

Features of Python

The following are some of the important features of

Simple:  It is a simple programming language. When we read a Python program, we feel like reading English sentences.

Easy to learn:  It uses very few keywords. Its programs use very simple structure. So, developing programs in Python become easy.

Open Source:  There is no need to pay for Python software. It can be freely downloaded from www.python.org. website.

Dynamically Typed:  In python, we need not declare anything. An assignment statement binds a name to an object, and  the object can be of any type.

Platform independent:  Python program are not dependent on any specific operating system, we can use Python almost all operating system like Unix, Linux, Windows, Macintosh etc.

Portable:  When a program yields the same result on any computer in the world, then it is called a portable program. Python programs  will give the same result since they are platform independent.

Procedure and object  oriented:  Python is a procedure oriented as well as an object oriented programming language.

Huge Library:  It has a big library which can be used on any Operating System. Programmers can develop programs easily using the modules available in the Python Library.

Database Connectivity:  Python provides interfaces to connect its programs to all major databases like Oracle, Sybase or MySQL.

Application of Python

Application of Python
  • General purpose language: Used to create Machine learning, Web applications/development, GUI, Software development.
  • Used alongside software to create workflows.
  • Connect to database systems. It can also read and modify files.
  • Can be used to handle big data and perform complex mathematics.
  • Can be used for rapid prototyping, or for production-ready software development.
  • Top companies using Python: Google, Dropbox, Youtube, Quora, Yahoo, NASA, Reddit 

Flavors of Python

Flavors of Python
Flavors NameDescriptions
CPythonThis is the standard Python Compiler implemented in C language.
JythonThis is earlier known as JPython. This is the implementation of Python programming language which is designed to run on Java.
IronPythonThis is the implementation of Python language for .NET framework.
PyPyThis is the Python implementation using Python language. PyPy is written in a language called RPython which was created in Python language.
AnacondaPython                           When Python is redeveloped for handling large scale data processing, predictive analytics and scientific computing, it is called Anaconda Python. This implementation mainly focus on large scale of data. Difference Between C and PythonDifference Between C and Python CPythonProcedure-oriented languageObject oriented languageCompiled languageInterpreted languageSaved with .c extensionSaved with .py extensionVariables are declared in CNo need of declarationPointers are availableNo pointers functionalityLimited number of built-in functionslarge library of built-in functionsDoes not have complex data structuresHave some complex data structuresStatically typedDynamically typedSyntax of C is complexSimple, easy to learn, write and readFaster Slower     

Difference Between Java and Python

Difference Between Java and Python
JavaPython
Compiled+ interpreted Language.It is an Interpreted Language
Statically typedDynamically typed
Complex learning curvePython is easy to learn and use
It is verbose. It means they contain more number of linesPrograms are concise and compact
It is multi-platform, object-oriented Language.High-level object-oriented programming language.
It uses curly braces to define the beginning and end of each function and class definition.It uses indentation to separate code into separate blocks.
Multiple inheritances is partially done through interfaces.Supports both single and multiple inheritances.
Limited string related functions.Lots of string related functions.
Java is faster.It is slower because python is an interpreter
Desktop GUI apps, Embed Systems, Web application.Excellent for scientific and numeric computing, ML.

Byte Code

Byte Code

•Python is usually called an interpreted language, however, it combines compiling and interpreting. When we execute a source code (a file with a .py extension),

•Python first compiles it into a byte code.

•The byte code is a low-level platform-independent representation of your source code, however, it is not the binary machine code and cannot be run by the target machine directly.

•In fact, it is a set of instructions for a virtual machine which is called the Python Virtual Machine (PVM).

•After compilation, the byte code is sent for execution to the PVM.

•The PVM is an interpreter that runs the byte code and is part of the Python system.

•The byte code is platform-independent, but PVM is specific to the target machine.

•The default implementation of the Python programming language is CPython which is written in the C programming language.

•CPython compiles the python source code into the byte code, and this bytecode is then executed by the CPython virtual machine.

Memory Management in Python

•Memory allocation and de-allocation are done during run time automatically.

•The programmer need not allocate memory while creating objects or de-allocate memory when deleting the objects.

•Python PVM will take care of such issues.

•Everything is considered as an object in Python. For every object memory should be allocated.

•Memory manager inside the PVM allocates memory required for objects created in a python program.

•All these objects are stored on a separate memory called heap.

•Heap is the memory which allocated during run time.

•The size of the heap memory depends on the RAM of our computer and it can increase or decrease.

Garbage Collection in Python

•A module represents Python code that performs a specific task. Garbage collector is a module in Python that is useful to delete objects from memory which are not used in the program.

•The module that represents the garbage collector is named as gc.

•Garbage collector in the simplest way to maintain a count for each object regarding how many times that object is referenced (or used).

•When an object is referenced twice, its reference count will be 2. when an object has some count, it is being used in the program and hence garbage collector will not remove it from memory. 

•When an object is  found with reference count 0, garbage collector will understand that the object is not used by the program and hence it can be deleted from memory.

•Garbage collector can detect reference cycles. A reference cycle is a cycle of references pointing to the first object from last object.

Leave a Reply

Your email address will not be published.