Upload
nilesh-sutar
View
294
Download
0
Embed Size (px)
Citation preview
Python For ALLVersatility of Python and how Python can make your life easier
Pragya Goyal and Nilesh Sutar1
Overview➢ About Python➢ Why Python➢ What people are doing with Python➢ What can we do with Python➢ Limitations of Python➢ Yet more reasons to learn Python
2
About Python“Quora”, a popular knowledge sharing platform, built over Python, quotes:
Python is a popular general purpose programming language
whose philosophy focuses mainly on code readability and
maintainability. As a high level, interpreted language, Python is
easy to learn for those who want to start coding.
3
Why PythonA dive into key features
● Programmability : Extremely modular design, making it very suitable to act as a gel between low level operation (in any language) and high level operations.
● Prototyping : Gives conducive environment to quickly develop prototypes. Smaller iterations. In line with spirit of Agile.
● Simplicity and Ease of Understanding : Extremely simple syntax, making it a very humane language. Less prone to errors. Very readable, hence promoting code re-usability.
● Object Oriented Programming(OOP) Language : Python supports both procedure oriented as well as OOP. Very powerful but simple way of doing OOP compared to languages like C++ or Java.
4
Why PythonA dive into key features
● Free and Open source: Open-source active community. Due to high readability and ease of programming, anyone can contribute to the open source community.
● Portable : Due to it’s Open source nature, Python has been ported to many platforms. Programs are also portable.
● Interpreted : Doesn’t require separate compilation and execution. ● Robustness and Automatic Garbage Collection : Doesn’t require
manipulation of memory and pointers. Memory managements can be done automatically with the help of garbage collectors.
5
Why PythonA dive into key features
● Language Interoperability(Extensibility) : Python excels at gluing other languages like MATLAB, C, C++, Java, Fortran.
● Extensive Libraries : Python has very rich source of Standard libraries.Besides the standard library, there are various other high-quality libraries such as Python Image Library
● Excellent Documentation System : Incorporates module, class, function, and method documentation directly into the language itself, through the usage of “docstrings”
6
What people are doing with PythonInteresting thing about Python is the surprising diversity of applications that it’s
been used for. People are using Python to:
● Run Web sites● Process large XML data sets● Data analytics● Mobile App Development● To teach Computer Science in Universities● Build test suites for C or Java code● Write GUI interfaces● Make a commercial application scriptable by embedding Python interpreter
7
What can we do with Python
Top use cases:
● Web Programming : Django, Pyramid, Bottle, Tornado, Flask, web2Py
● GUI Development : wxPython, tkinter, PyGtk, PyGObject, PyQt
● Scientific and Numeric : NumPy, SciPy, Pandas, IPython
● System Administration : Ansible, Salt, OpenStack
● Network Programming : Paramiko, OpenSSH, E-mail processing, Twisted
● Mobile Apps : Kivy
● Game Development : PyGame
….and more ahead8
What people are doing with PythonProjects using Python
https://wiki.python.org/moin/OrganizationsUsingPython 9
What can we do with PythonWeb Development
● Common Gateway Interface(CGI)
● Frameworks :– Full stack frameworks : Django, Zope, Pylons– Non-Full stack frameworks : Bottle, Flask, CherryPy, Pyramid
● Data persistence :– Relational Databases : MySQL, PostgreSQL, Oracle, MSSQL– Non-Relational Databases : SQLite, MongoDB– ORM support : SQLAlchemy, SQLObject
● Content Management System(CMS) : Django CMS.10
What can we do with PythonREST Interface
Various Frameworks can help kickstart with REST: Flask, Bottle, Django-REST, Django-tastypiee.g. GET with Flask:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
11
What can we do with PythonNetwork Programming/DevOps
OpenSSH: An ubiquitous method of remote access for secure remote-machine login and file transfers, widely used by Systems administrators, Automation Test Engineers, etc.
SSH access and File transfer#!/usr/bin/python
import paramiko
IP="172.25.24.37"; username='synerzip'; password='synerzip';
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(IP, username=username, password=password)
stdin, stdout, stderr = client.exec_command("uptime")
print stdout.readlines()
ftp = client.open_sftp(); ftp.get('remotefile.py', 'localfile.py'); ftp.close();
client.close()12
What can we do with PythonData Science
When the focus is research, keep your programming worries aside, with powerful tools provided by Python:● nltk : A wonderful tool for teaching, and working in computational linguistics.
Amazing library to play with Natural Language.● scikit-learn : Easy to use machine learning library. Contains simple and
efficient tools for data mining and data analysis.● Pandas : Library providing high-performance, easy-to-use data structures and
data analysis tools. Aims to become the most powerful and flexible open source data analysis / manipulation tool available in any language.
https://www.kaggle.com/wiki/GettingStartedWithPythonForDataScience
13
What can we do with PythonTesting
Making your tests work harder and smarter… to make your life easier!● Agile Development with Test Driven Development/Functional Testing:
○ Unit Testing○ API testing○ Tools : Nose, Unittest, Pytest
● Integration Testing:○ Interaction between two different components or subsystems
● End-To-End Testing(Automation):○ UI Automation using Selenium tool○ Test Script for REST using requests.
14
Limitations
● The infamous GIL : Multithreading is not a good idea in Python, when aiming performance, due to GIL. Good alternatives: Multiprocessing, Stackless Python
● Not suited for low level programming. Slower than the underlying C/C++
15
Yet more reasons to learn Python
Why it's worth learning Python despite the limitations:
“A comparatively small number of problems are constrained by the speed of the algorithm. A comparatively large number of problems are bounded by the speed of the developer.”
- Robert Rossney (Stack Overflow User)
“Python allows us to tackle the complexity of programs like the WAS without getting bogged down in the language. Things just work the first time. No other language exhibits that trait like Python.
- Robin Friedrich (NASA Engineer)
16
Interested?Join us for training
17