This document provides an overview of a session on introducing Python programming. It discusses the history and creators of Python, its features as a high-level, general purpose, multi-paradigm language. Examples are given of successful organizations using Python like Google, Mozilla, and CERN. Sample Python code is shown for word counting programs. Common questions about Python versions, development environments, debugging, and performance are addressed. Reasons for Python's readability and popularity over other languages are explored. References for further learning Python are provided.
3. Session Overview
1. The clichéd title
2. Python & PSF
3. Features of Python
4. Success stories: using Python
5. Sample programs
6. FAQs
7. Python programs are ‘slow’ – Myth?
8. Why is Python preferred by many?
9. Reference Links
4. The clichéd title
Any programming tutorial starts with a ‘Hello, World!’ program.
Let’s use the same to answer ‘Why Python?’
5. Python & PSF
• “hobby” programming
project
• Interpreter for a
scripting language
Dec 1989
• Python 2.0 – 16th Oct
• Unicode Support, cycle-
detecting GC
Oct 2000 • Python 3.0
• Backward-Incompatible
• Features backported to
backward compatible
2.7.x, 2.6.x
Dec 2008
Guido van Rossum – creator of Python
– benevolent dictator for life (BDFL)
Python Software Foundation(PSF) - manages the open-source licensing for Python 2.1 and later
- mission is to promote, protect and advance Python; support
and facilitate growth of international & diverse community of Python programmers. [2001]
8. Success Stories using Python
8
Web &
Analysis
• Mozilla
• Google
• Youtube
• Bitly
• ForecastWatch
.com etc
Science,
Energy
•ExpEYES [portable
scientific laboratory]
•VAMPZero [aircraft
conceptual design]
• Eco Mode @ SMS
Siemag AG
• Large Hadron
Collider (CERN)
•EPRI (Life on Mars -
ESA) [Python
powered clusters
and graphics
processing]
Animation &
Graphics
• Blender
• Houdini
Systems
Cloud, Data
Centers etc.
• Open Stack
• Google App
Engine
• Flying Circus
• rackspace
Others
• Scientific &
Numeric
Processing –
SciPy, NumPy
• Machine
Learning &
Analytics –
SocialCorps,
Innoplexus,
Fractal Analysis
• Automation of
applications [
Jython]Oracle
in ODI
9. A few lines of code..
9
Examples shown use Python 2.7.12
A simple word-count program – Python shell/command line
A simple word-count program using the os module – Python shell/command line
10. A few more lines of code..
10
Examples shown use Python 2.7.12
Code to check the word count limit for multiple files
Save this code in a file as pgm.py
From the command line (Linux) – execute it using: python pgm.py
Or from within IDLE shell - execfile('pgm.py')
11. A few FAQs
11
1. What version to choose – 2.7.x or 3.x?
https://wiki.python.org/moin/Python2orPython3
2. What to use for development?
1. Any text editor (from notepad to Sublime Text)
2. IDE (Eric, Pycharm)
3. Online Web Application: Jupyter (iPython)
3. How to run?
1. Use the command line python filename [arguments]
2. Use the Python shell execfile(filename[,arguments])
4. How to debug?
pdb module https://docs.python.org/2/library/pdb.html
12. Is Python ‘slow’ ? Why?
12
Yes – most of the raw code is slower than C/C++. But it is faster
than Ruby/JavaScript [Source: Internet]
A few reasons are:
1. Dynamic v/s Static typing
2. Interpreted v/s Compiled
3. Inefficient memory access due to its object model (list
access)
But there are hacks to overcome these: vectorised operations
[SciPy, NumPy etc.], calling compiled code, using specific
libraries etc.
Read more at: https://jakevdp.github.io/blog/2014/05/09/why-python-is-slow/
16. BITS Pilani, Pilani Campus
Python – About, Documentation, Downloads etc. - https://www.python.org/
Python Software Foundation - https://www.python.org/psf/
Logos and Usage - https://www.python.org/community/logos/
History and Timelines -
https://en.wikipedia.org/wiki/Python_(programming_language)
Some Success Stories and Case studies -
http://brochure.getpython.info/media/releases/psf-python-brochure-vol.-i-
final-download.pdf/at_download/file
Some Tutorials/Books to start with:
The Python Tutorial https://docs.python.org/3/tutorial/
LearnPython.org http://www.learnpython.org/
Think Python: How to Think Like a Computer Scientist – Allen. B.
Downey http://www.greenteapress.com/thinkpython/html/
Python Playground: Geeky Projects for the curious Programmer –
Mahesh Venkitachalam https://www.nostarch.com/pythonplayground
Reference Links