• C programing concern with functional aspect. We are concerning with writing code using
• Programing will become easy if it based on real life example, hence they develop Object
Oriented Language like Java and .NET where programing done with Classes and Objects.
• Java Program to Write sum of two numbers
• C program to write sum of two numbers
• Python style
• Python was developed by Guido Van Rossum in year 1991, at center for mathematics and
Computer science managed by Dutch Govt.
• Developer was working on project to develop system utilities in C where he had interact with
bourn shell available in UNIX.
• Python name appeared from the TV Show Monty Python’s Flying Circus
• Official launched on 20th Feb 1991.
• Python is Open Source.
FEATURES OF PYTHON
• Easy to learn
• Open Source
• High level Language
• Dynamically Typed
• Platform Independence
• procedure and Object oriented
• Simple-Python is simple programing Language .felt like reading English sentences. It means more
clarity and less stress on understating of syntax of language
• Easy to learn – uses very few keyword , program structure is simple. Similar to C programing .
Hence Migration from C to Python is easy for programmers.
• Open Source - easily available for download www.python.org
• High level Language – Similar to English Language , low level language Machine understandable
• Dynamically Typed-in Python , we are not declaring anything.an assignment statement binds a
name to an objects can be of any type. If a name is assigned to an objects of one type, it may be later
be assigned to an objects of different type.
• >>>year = 2017
• >>> dec = 1.1
• >>> hello = 'Hello, World!'
• >>> alphabet = ['a','b','c']
• But what ‘types’ are these variables? Let’s use the types module to find out:
• >>> from types import *
• >>> type(year)
• <type 'int'>
• >>> type(dec)
• <type 'float'>
• >>> type(hello)
• <type 'str'>
• >>> type(alphabet)
• <type 'list'>
• As you can see, I didn’t have to tell Python what ‘type’ each variable value was, it assigned the
• Platform Independent-
• Procedure and OOPS based.
• Class is collection of objects having similar attributes and operation.
• Python Packages –
• BOTO is amazon web services
• CherryPy is Object oriented HTTP framework
• Fiona reads and write big data files.
• Mysql-connector –python is driver written in python to connect to MySQL database
• Numpy-is a package for processing array of single or multidimensional type
• Pandas is package for powerful data structure for data analysis, time series and statistics
• Pillow is python imaging library.
• Pyquery represent jquery like library for python.
• W3lib is library of web related function.
EXECUTION OF PYTHON PROGRAM
• Python program can write in abc.py where abc is name of the program wheras .py is extension
• Compile the program into python compiler.
• Byte code.
C VS PYTHON
C programing Python Programing
C program execute Faster Slower compared to C
Type Declaration Compulsory Not required
C language type discipline in static and weak Python type discipline is dynamic and Strong
Pointers available No Pointers
C ha s switch statements No switch statement
Memory allocation using malloc and calloc Memory allocation and Deallocation done by PVM
Procedural approch Oops based
JAVA VS PYTHON
Memory allocation and deallocation done by JVM PVM
Switch is allowed No switch
A semicolon is used to terminate the statement and
comma is used to separate expression.
New line indicate end of statement and semicolon is
used as an expression separator
Array index is positive integer Can be positive or negative.
Static and weak Dynamic and strong
Oops languages, functional programing used in java
8.0 in lamda expression
Oops language, blends functional programming with
lambda expression inbuild.
• Python source file converted in Byte Code format.
• Byte code represent the fixed set of instruction created by python developers representing all
types of operations.
• And store that file in .pyc extension
• Role of PVM to convert that byte code into machine understandable code, so that computer can
execute that machine code and display result.
• To carry out this conversion , byte code into machine code and sends that machine code to
computer processor for execution. Since Interpreter plays main role, often pvm also mention as
• Frozen binary executables are packages that combine your program's byte code and the Python
interpreter into a single executable program. With these, programs can be launched in the same
ways that you would launch any other executable program (icon clicks, command lines, etc.).
MEMORY MANAGEMENT IN PYTHON
• Python , memory allocation and deallocation are done during runtime automatically.
• The programmer need not allocate memory while creating objects or deallocate memory when
deleting the objects. Python PVM take care of such issues.
• Everything is consider as an objects in Python. Example Strings are objects, list are objects ,
functions are objects.
• For every object, memory should be allocated .memory manager inside PVM allocates memory
required for the objects created in Python Programming .
• All these objects are stored on separate memory called Heap.
• Heap is memory which allocated during runtime.
GARBAGE COLLECTION IN PYTHON
• Python’s memory allocation and deallocation method is automatic.
• Python uses two strategies for memory allocation:
• Reference counting
• Garbage collection
• the Python interpreter only used reference counting for memory management. Reference counting
works by counting the number of times an object is referenced by other objects in the system. When
references to an object are removed, the reference count for an object is decremented. When the
reference count becomes zero, the object is deallocated.
Parece que tem um bloqueador de anúncios ativo. Ao listar o SlideShare no seu bloqueador de anúncios, está a apoiar a nossa comunidade de criadores de conteúdo.
Atualizámos a nossa política de privacidade.
Atualizámos a nossa política de privacidade de modo a estarmos em conformidade com os regulamentos de privacidade em constante mutação a nível mundial e para lhe fornecer uma visão sobre as formas limitadas de utilização dos seus dados.
Pode ler os detalhes abaixo. Ao aceitar, está a concordar com a política de privacidade atualizada.