[go: up one dir, main page]

0% found this document useful (0 votes)
8 views25 pages

Pymodule 1

The document provides an overview of Python programming, highlighting its characteristics as a high-level, open-source language developed by Guido Van Rossum in 1991. It discusses different programming paradigms, including procedure-oriented and object-oriented programming, and emphasizes Python's ability to combine both styles. Additionally, it covers features of Python, memory management through garbage collection, and compares Python with C.

Uploaded by

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

Pymodule 1

The document provides an overview of Python programming, highlighting its characteristics as a high-level, open-source language developed by Guido Van Rossum in 1991. It discusses different programming paradigms, including procedure-oriented and object-oriented programming, and emphasizes Python's ability to combine both styles. Additionally, it covers features of Python, memory management through garbage collection, and compares Python with C.

Uploaded by

ryanut.jb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Python Programming [R4ET2015T+P]

by
Karuna Bhalerao
Assistant Professor, VJTI, Matunga, Mumbai
400019
Contact: karunabhalerao@el.vjti.ac.in
Mob: 8378919162
Python is a high level language

2
Python is a high level language

3
Python is a high level language

4
Types of Programming
Procedure Oriented Programming:
Programming languages like C, Pascal or FORTRAN concentrate
more on the functional aspects of programming. In these
languages, there will be more focus on writing the code using
functions.

For example, we can imagine a C program as a combination of


several functions.

5
Types of Programming

Object Oriented Programming :


Languages like Java and .NET where programming is done
through
classes and objects.

In Java, a programmer should express his logic through classes


and objects only. It is not possible to write a program without
writing at least one class! This makes programming lengthy.

6
Types of Programming
What if we want both ?

When we want to develop functional aspects like calculations or


processing, we want to use C style coding and when we are in
need of going for classes and objects, we will use Java style
coding. But what can be used when we want both functional as
well as classes aspects?

The only answer for their requirement is Python!

Python is a programming language that combines the features of


C and Java. It offers elegant style of developing programs like C.
When the programmers want to go for object
orientation, Python In Python, the program to add two
numbers will be as follows:

7
Python
Python was developed by Guido Van Rossum in the year 1991 at
the Centerfor Mathematics and Computer Science managed by
the Dutch Government.

Van Rossum picked the name Python for the new language from
the TV show, Monty Python’s Flying Circus 1991.

Python is open source software.

The logo of Python shows two intertwined snakes as shown in the


figure below

8
Features of Python
Simple
Easy to learn
Open source
High level languge
Dynamically typed
Platform independent
Poratable
Procedure & Object
Oriented

10
Class & Object
Class & Object

Since class does not exist physically, there will not


be any memory allocated when the class is
created. But, object exists physically and hence, a
separate block of memory is allocated when an
object is created.
Properties of Python
Properties of Python
Properties of Python
Execution of a Python Program
Python Virtual Machine (PVM)
Flavors of Python

CPython
Jpython
PyPy

AnacondaPython
Frozen Binaries

20
Memory Management in Python
Memory Management in Python

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.


Memory Management in Python

Garbage Collection in Python

• 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 a reference count 0, garbage collector will


understand that the object is not used by the program and hence it can
be deleted from memory. Hence, the memory allocated for that object
is deallocated or freed.
C Vs Python
C Vs Python
C Vs Python
End of Module-I

You might also like