0% found this document useful (0 votes)
3 views10 pages

Basic Info Python

Python info

Uploaded by

paham13547
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views10 pages

Basic Info Python

Python info

Uploaded by

paham13547
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Essentials of Python

Basic Details on Python


Programming Language
• Python was developed by Guido Van Rossum during 1985- 1990.
• It is named after a TV Show called ‘Monty Python’s Flying Circus’ and not after
Python-the snake.
• It is an open source, platform independent, general-purpose high-level
programming language which contains features of functional programming
language like C and object-oriented programming language like java.
• Python is case sensitive in nature
• Python programming language is being updated regularly with new features
and supports.
• There are lots of update in Python versions, started from 1994 to current
release.
Executing a Python Program
• There are 3 ways of executing a python program. Using python’s command line
window
 Using python’s IDLE graphic window/python shell
 Directly from command prompt of operating system
Write the python program using any editor and save it in desired directory.
• To get help on any topic write help() on python command line window and press
enter. Now type modules/topics and press enter. This will display the list of
modules/topics available in python.
Running a python program from python shell
• Open the IDLE/python shell window
• To create a new file, press Alt+N and give the name and specify the
location for new file.
• To open an existing file, FileOpen specify the path
• Once file has been opened or code in new file has been written, press
F5 key.
• This will display the result on python shell
Running a python program from command
prompt of Operating System
• Using any editor, type the python program and save it in a directory.
• Now through the command prompt, go to the directory where
program has been saved.
• Call the program name [Link] extension program_name.py
• Now press enter and see the result of the program.
Python Program Execution
• A python program is always saved with .py extension.
• Byte code represents the fixed set of instructions that represents all operations
like arithmetic, comparison, memory related operations etc.
• Byte code can run on any OS and hardware so it is system and platform
independent.
• Size of each byte code instruction is 1 byte, so it is called byte code.
• PVM uses an interpreter which understands the byte code and
converts it into machine code understandable to that processor and
into the format understandable to OS.
• Machine code instructions are then executed by processor and results
are displayed.
Python Compiler

• Cpython: This is written in C language. Python program is internally converted


into byte code using C language functions and byte code is run on interpreter
available in PVM created in C language.
• Jython: This is written in java language. Jython compiler first compile the python
program into java byte code and it is executed by java virtual machine (JVM) to
produce the output.
• IronPython: This is written in C# language. Python program after compilation
gives an intermediate language (IL) which runs on common language runtime
(CLR) to produce the output.
• Pypy: This is written in python language.
Memory Management in Python
• In python, memory allocation and deallocation are done automatically at
runtime.
• Memory manager is a module inside PVM which allocates memory to all objects.
• Everything is considered as object in python. E.g. strings, list, number are all
objects. All objects are stored on separate memory heap at run time. Size of heap
memory depends upon size of computer RAM.
• Garbage collector is another module in PVM which will deallocate memory for
the unused objects. This module is executed automatically when the Python
program is running in memory.
To do…
• Explore the differences: C vs Python and Java vs Python

You might also like