What is Python?

Rumman Ansari   Software Engineer   2023-02-22   515 Share
☰ Table of Contents

Table of Content:


What is Python?

Python is a high-level, interpreted, interactive, and object-oriented scripting language. It is designed to be highly readable:

  • Points to know about Python -It supports functional and structured
    programming methods as well as OOP.
  • It supports automatic garbage collection.
  • It can be used as a scripting language and can be compiled to byte-code for building large applications.
  • It provides very high-level dynamic data types and supports
    dynamic type checking.
  • It can be easily integrated with
    i. C,
    ii. C++,
    iii. COM,
    iv. ActiveX,
    v. CORBA,
    vi. Java.

How is Python an interpreted language?

An interpreter is a kind of program that executes other programs. When you write Python programs, it converts source code written by the developer into the intermediate language which is again translated into the native language/machine language that is executed. The Python code you write is compiled into Python bytecode, which creates a file with extension .pyc . The compilation is simply a translation step, and byte code is a lower-level, and platform-independent, representation of your source code.

The .pyc file, created in the compilation step, is then executed by appropriate virtual machines. The Virtual Machine is the runtime engine of Python and it is always present as part of the Python system and is the component that truly runs the Python scripts. Technically, it’s just the last step of what is called the Python interpreter.


In which application area Python can be used?

Python can be built in the following areas:

  • GUI-based desktop applications
  • Web applications
  • Games
  • Scientific and computational applications
  • Language development
  • Enterprise and business applications development
  • Operating systems

What are the benefits of Python?

Here are the benefits of Python:


Open source: Python language is developed under an OSI-approved open source license, which makes it free to use and distribute, including for commercial purposes.


Easy learning: Python offers excellent readability and uncluttered simple-to-learn syntax which helps beginners to utilize this programming language.


Extensive support library: Python provides a large standard library that includes areas such as Internet protocols, string operations, web services tools, and operating system interfaces. It reduces the length of code to be written significantly.

User-friendly data structure: Python has built-in list and dictionary data structures that can be used to construct fast runtime data structures. Productivity and speed: Python has clean object-oriented design, provides enhanced process control capabilities and possesses strong integration and text processing capabilities and its unit testing framework, all of which contribute to the increase in its speed and productivity.


Explain memory management in Python?

Memory management is the process of efficiently allocating, deallocating, and coordinating memory so that all the different processes run smoothly and can optimally access different system resources. Memory management also involves cleaning the memory of objects that are no longer being accessed.
In Python, the memory manager is responsible for these kinds of tasks by periodically running to clean up, allocate, and manage the memory. Unlike C, Java, and other programming languages, Python manages objects by using reference counting. This means that the memory manager keeps track of the number of references to each object in the program.

Lets understand memory management by following points:

  • Python memory is managed by Python private heap space. All Python objects and data structures are located in a private heap.
  • The programmer does not have access to this private heap and the interpreter takes care of this Python private heap.
  • The allocation of Python heap space for Python objects is done by the Python memory manager. The core API gives access to some tools for the programmer to code.
  • The Python memory manager manages chunks of memory called “Blocks”. A collection of blocks of the same size makes up the “Pool”. Pools are created on Arenas, chunks of 256kB memory allocated on heap=64 pools. If the objects get destroyed, the memory manager fills this space with a new object of the same size.
  • Python also has an inbuilt garbage collector, which recycles all the unused memory and frees the memory and makes it available to the
    heap space.