Topics
¨ So what’s Python?
¨ Why do people use Python?
¨ A Python history lesson
¨ Advocacy news
¨ What’s Python good for?
¨ What’s Python not good for?
¨ Python technical features
¨ Python portability
“An open
source, object-oriented, scripting language”
¨ An “open source” software project
Ø A BDFL plus a cast of thousands
Ø Mature infrastructure: PEPs, test suite, PSF
Ø You are not held hostage by a vendor (VB!)
¨ An “object-oriented” language
Ø OOP is an option, but a nice one
Ø Supports code reuse
¨ A “scripting” language
Ø But not just for shell tools—general purpose
Ø Control language: C/C++ libs, Com, .
Ø Easy to use: 3x ~ 4x less code than Java, C++
Plus…
Ø
General purpose
Ø
Tactical or strategic
Ø
Stand alone or embedded
Ø
Very high-level, dynamic
Software Quality
Ø
Readable syntax: maintainable
Ø
Coherent design, small set of interactions
Ø
Simple enough to remember
Ø
Art versus Engineering è maintenance, reuse
“You can do everything in Python that you can do in Perl, but you can read your code after you do it.”
Developer Productivity
Ø
Smaller programs, flexible code (“agile”)
Ø
Rapid turnaround, code reuse
Ø
Tactical and strategic roles
Ø
Good in boom and bust times
And other reasons…
Ø
Program portability: portable sytem tools, …
Ø
Component integration: reuse of libs,
customization, …
Ø
Vast application libraries: everything under the
sun…
Ø
Open source
¨ “Python looks like it was designed, not accumulated.”
¨ “It bridges the gap between scripting languages and C.”
¨ “It’s as easy or as powerful as you want it to be.”
¨ “Python: less filling, tastes great. :-)”
¨ “Python fits your brain.”
Seen on comp.lang.python…
¨
Created by Guido
van Rossum in
¨ now a Google employee
¨ Google is largely Python code, as is YouTube
¨ USENET newsgroup started in 1994
Ø comp.lang.python,
www.python.org
Ø
3rd
party add-ons: Vaults of
Parnassus, PyPI
¨ Python Software Foundation (PSF): O’Reilly, ActiveState, Zope
¨ First Python books appeared Fall, 1996, over 50 available by 2003
¨
International following: US,
¨
Community: 750K to 1M users worldwide
(guesstimate), user groups, two annual
¨
Named after 70s
Ø On the significance of Spam…
Noteworthy users
Web services:
Google, YouTube, Yahoo
Animation: Industrial Light & Magic, ImageWorks, Disney, Pixar
Financial: JP Morgan Chase, UBS, Getco, NYSE
Hardware Testing: Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, Micron
Numerics:
National Weather Service,
P2P downloads: BitTorrent (32M DLs, 1/3 of all inet traffic!)
Other: iRobot, ESRI, NSA, IronPort, Red Hat, Jet Propulsion Lab, Eve Online, MIT compsci courses, …
Domains
IronPython for .
Windows COM
Jython Java port
Zope & Plone web site frameworks
Mac OS X
Sun’s Coyote project?
Cellphone ports
Compilers
IronPython
(Microsoft), Python.net for C#/“.
Jython for Java
Standard C-Python
PyPy & Psyco
Parrot
Group therapy
Python user groups:
Books
Over 50 Python books available, 40+ English language, a dozen non-English books, more on the way (see Resources)
Press
O’Reilly’s Python Success Stories; Pythonology users list; Guido on the cover of Linux Journal, Dr. Dobbs Journal, in Washington Post
Education
Guido’s Computer Programming For Everybody (CP4E), edu-sig, tutors list
Services
Commercial support, training; pre-packaged distributions; standard on Linux and Mac OS X
Jobs
Python job board; hundreds of hits on monster and dice
Other
30% increase in python.org traffic for year ended March ‘05
PyCon conference attendence increase: 400-500 ’05 vs 200-300 ‘04
Jolt productivity award given to Python 2.4 early ‘05
InfoWorld: 6% gain in popularity ’05 (14% use rate ‘05 vs 8% ’04)
Google open source site, Python projects
General purpose:
=> Almost anything computers can do
¨
System programming: shell tools, test scripts
sockets, regex, POSIX calls, threads, streams
¨ Graphical user interfaces
Tk, wxPython, Qt, Gtk,
¨ Internet scripting
¨
Database programming
Persistent objecs, ZODB, Oracle, Informix, Sybase, MySQL,…
¨ Component integration
Product customization and testing, embedded scripting, system front-ends
¨ Rapid Application Development
Prototype-and-migrate, fast turnaround, deliverable prototypes
¨ And more specific domains: general purpose
COM (PyWin32), Numeric programming (NumPy), Gaming (PyGame), graphics (OpenGL, Blender), AI, CORBA,...
¨ Fast enough for most tasks as is
¨ Most real tasks run linked-in C code
¨ Exception truly speed-critical components
¨ Solution: implement in C and export to Python
¨ Python is optimized for speed-of-development
¨ Python is designed for multi-language systems
¨ Example: Python Numeric Programming
¨ Psyco
Embedding Extending
¨ No compile or link steps
Rapid development-cycle turnaround
¨ No type declarations
Programs are simpler, shorter, and flexible
¨ Automatic memory management
Garbage collection avoids bookkeeping code
¨ High-level datatypes and operations
Fast development using built-in object types
¨ Object-oriented programming
Code structuring and reuse, C++ integration
¨ Extending and embedding in C
Optimization, customization, system ‘glue’
¨ Classes, modules, exceptions
Modular ‘programming-in-the-large’ support
¨ A simple, clear syntax and design
Readability, maintainability, ease of learning
¨ Dynamic loading of C modules
Simplified extensions, smaller binary files
¨ Dynamic reloading of Python modules
Programs can be modified without stopping
¨ Universal ‘first-class’ object model
Fewer restrictions and special-case rules
¨ Interactive, dynamic nature
Incremental testing, runtime program coding/construction
¨ Access to interpreter information
Metaprogramming, introspective objects
¨ Wide interpreter portability
Cross-platform systems without ports
¨ Compilation to portable byte-code
Execution speed, protecting source-code
¨ Built-in interfaces to external services
O/S, GUI, persistence, DBMS, regular expressions...
¨ True ‘freeware’: Open Source software
May be embedded/shipped without copyright restrictions
¨ Core Language + Standard Library
¨ Unix, Linux, Windows, Macs
¨ Cray
supers,
¨ PDAs: PalmOS, PocketPC, Zaurus
¨ OS/2, VMS, Next, BeOS, QNX, Itanium
¨ Amiga, AtariST
¨ PlayStation, XBox, Gamecube
¨ Nokia Symbian OS cellphones
¨ Windows Mobile cellphones/PDAs
¨ Ipods
¨ …
¨ Platform-specific Extensions
¨ COM on Windows (PyWin32 extension)
¨
¨ General Portability
¨ Bytecode is platform-neutral
¨ Tkinter GUI library: X (Unix), Windows, Macs
¨ Standard library system calls (module “os”)
Versus |
Python advantage |
Description |
Tcl |
Power |
Python better at
“programming in the large”: module, OOP, exceptions, etc. |
Perl |
Coherence |
Python has a readable,
maintainable syntax, fewer special
variables, etc. |
Java |
Simplicity
Turnaround |
Built-in objects, dynamic
typing, etc.; can be freely shipped with products. |
C++ |
Simplicity
Turnaround |
Interpreted language
turnaround; avoids C++ language complexity. |
Smalltalk |
Conventional |
In Python, “if” statements
are not message-receiver objects. |
Ruby |
Flexibility,
maturity |
Python more readable, more
like C++: both procedural and OO (optional) |
Scheme, Lisp |
Conventional |
Python’s syntax is closer
to traditional languages like C and Pascal. |
Visual Basic |
Power,
Portability |
Python is powerful,
cross-platform, and not controlled by one company (Python cannot be
discontinued!) |
¨ But your mileage may vary
· Different language design goals
· Programmers matter too
· Many languages are a Good Thing
· Python coding may be too easy: design and brains still matter
¨ It’s object-oriented
·
Powerful OO support
·
But OO is an option
¨ It’s free
·
Can freely embed and ship in products
·
Can even sell the source-code!
¨ It’s portable
·
Runs everywhere: Unix, Windows, Mac,…
·
Portable byte-code, portable Tkinter GUI interface
¨ It’s powerful
·
Built-in types and operations
·
Dynamic typing, libraries, modules, garbage collection, …
¨ It’s mixable
·
Python/C, Python/C++, Python/Java, COM
¨ It’s easy to use
·
Fast turnaround after changes
· A simple language and syntax
¨ It’s easy to learn
·
For developers and product customers
=> Quality and Productivity
A scripting language doesn't have to look like one