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
♦
Nonproprietary:
you are not held hostage by a vendor (see VB, Apple)
♦
But you are dependent
on core developers—at least on the
leading edge
● An “object-oriented” language
♦
OOP is an option,
but virtually required for larger projects
♦
OOP provides
structure and code reuse in ways other tools do not: extendable code
hierarchies
♦
But Python isn’t just OO—procedural, functional, OO
● A “scripting” language
♦ Control language: C/C++ libs, Com, Java/.NET,
Soap/XML-RPC, Corba, RIA/AJAX/OpenStack…
♦ But Python is general
purpose—not just for shell tools or simple programs
♦ Easier to use: typically 1/3 ~ 1/4 as much code as Java, C++
(syntax, typing, built-ins, libs)
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
►Both
tactical and strategic roles
►Good
in both boom and bust times
And other reasons…
►Program
portability: portable system tools, …
►Component
integration: reuse of libs, customization, …
►Vast
application libraries: everything under the sun (but creates dependencies)
►Open
source: no vendor tie-in (but still dependent on developers’ whims)
■ “Python looks like it was designed, not accumulated.”
Though it’s gotten busier in recent years
■ “It bridges the gap between scripting languages and C.”
Though it’s grown more complex in recent years
■ “It’s as easy or as powerful as you want it to be.”
Though nontrivial software is never easy
■ “Python: less filling, tastes great. :-)”
Though it’s now 3-paradigms, 2-versions, feature-rich
■ “Python comes with batteries included.”
Though batteries can also be your weakest link
■ “Python fits your brain.”
Though it depends on your brain…
● Created by Guido van Rossum in Amsterdam, 1990
♦ A Google employee for some time (then Dropbox)
♦ Google was/is largely Python code, as is YouTube
♦ Dropbox was/is mostly Python code on client+server
♦ Still Python’s BDFL, though the product of very many
♦ See Guido’s pages or search for more background
● USENET newsgroup started in 1994
♦ comp.lang.python, www.python.org
♦ 3rd party add-ons: PyPI,
google.com, web search
● Python Software Foundation (PSF): O’Reilly, ActiveState, Google, Enthought, and many others
● First Python books appeared Fall, 1996, over 50 available by 2003, over 200 on amazon.com by 2012
● International following: US, Europe, Asia, Australia, etc.
● Community: users (1M+ guesstimate; 10M on Github); user groups (see the list); conferences (PyCon: 2,500 attendees by 2010s, OSCON, and alot more)
● Named after 70s BBC comedy group “Monty Python's Flying Circus” (no, really)
♦ Shrubbery, Ni!, Brian, The Spanish Inquisition
♦ On the significance of Spam…
The
Latest…
Python continues to enjoy an active and vigorous
community today. It is generally
considered to be one of the top 5 (or 10) most widely used programming
languages in world, and is still growing in popularity by most metrics,
including:
● Conference attendance: 2,500 or more recent PyCons
● Book sales: O'Reilly, Amazon
● User base success
stories, quotes, and domains
● Web presence as tracked by the TIOBE index
● Other web presence trackers: Redmonk, PyPL
● Volume of open source contributions as measured by Ohloh.net
● Software support and resources
● And more: http://learning-python.com/books/about-python.html#resources
Noteworthy users
● Web services: Google, YouTube, Dropbox
● Animation: Industrial Light & Magic, ImageWorks, Disney, Pixar
● Financial: JP Morgan Chase, UBS, Getco, NYSE
● Games: Eve Online, Civilization IV
● Hardware Testing: Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, Micron
● Numerics: National Weather Service, Los Alamos, NASA
● P2P downloads: BitTorrent (32M DLs, 1/3 of all inet traffic!)
● Other: Calibre, iRobot, ESRI, NSA, IronPort, Red Hat, Jet Propulsion Lab, MIT compsci, Google App Engine, OLPC, OpenStack, Raspberry PI, …
Deployments
● Standard CPython (coded in C)
● IronPython for.NET/Mono (Microsoft), Python.net
● Jython for Java JVM
● PyPy (& Psyco): CPython optimized for speed
● Stackless: CPython for massive concurrency
● Numba, Cython: optimized solutions for numeric work
● Windows COM interface
● Web site and cloud frameworks: Django, AppEngine, …
● Mac OS X Cocoa integration
● Cellphone ports: Symbiam, Android, iOS, …
● RIAs: pyjamas (now pyjs), Silverlight, Flex, …
Group therapy
● Python user groups: everywhere today; see python.org user groups list and community page
Books
● Over 200 Python books available per amazon.com by 2012, English and other languages
Press
● Python.org’s quotes and success stories; and probably thousands more: search the web…
Education
● Computer Programming For Everybody (CP4E), edu-sig, tutors list, Raspberry PI, Code.org
Services
● Commercial support, training, books; distributions: py.org, ActiveState, Enthought, standard on Linux, Mac OS X
Jobs
● Thousands: see python.org job board or search the web, Dice.com, stackoverflow, etc.
Other
● PyCon conference attendance increases:
♦ 400-500 ’05 vs 200-300 ’04 …
♦ to 1,000 in 2008-2010 …
♦ to > 2,000 in 2012 Pycon
♦ 2,500 in all recent PyCons
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, Swing (Jython), RIAs (pyjamas/pyjs, etc.)
● Internet scripting
CGI, email, FTP, Telnet, Jython applets, XML-RPC, SOAP, PSP, mod_Python (Apache), RIAs, Django, Twisted, etc.
●
Database programming
Persistent objects, ZODB, Oracle, Informix, Sybase, MySQL, Sqlite (standard lib), SQLObject, SQLAlchemy, …
● 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, Maya), AI, CORBA, CAD, data mining, instrumentation, language, ...
● 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
● JIT (PyPy, Numba) may also improve speed
● 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
♦ Windows, Linux, Macs, Unix
Nearly all flavors
Runs in desktop mode on Windows 8
Runs as a grown-up on Windows 10
Windows XP dropped as of 3.5
♦ Assorted platforms
Java (Jython)
.NET (IronPython)
JavaScript (pyjamas/pyjs)
Android (SL4A), Galaxy tablet, iOS, Raspberry PI
♦ And others, rare and nostalgic…
Cray supers, IBM mainframes, VxWorks realtime
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 (if flashed)
● Platform-specific Extensions
♦ COM on Windows (PyWin32 extension)
♦ Cocoa on the Mac (Standard component)
♦ Other runtime libraries: Java, .NET, Javascript
● General Portability
♦ Bytecode is platform-neutral
♦ Portable GUIs: [tT]kinter, wxPython, PyQt, etc.: Windows, Linux, Macs, Unix
♦ Standard library system calls (most in module “os”)
Versus |
Python advantage |
Description |
Tcl, Lua |
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 is a Good Thing
♦ Python coding can be too easy: design and brains still matter (beware the temptation to “hack”)
♦ Full-scale software development is not trivial in any language (though Python helps)
♦ Off
page: hobbyists versus professionals,
in Answer Me These
Questions Three…
● 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 (relative to others)
♦
Fast turnaround after changes
♦ A simple language and syntax
● It’s easy to learn (relative to others)
♦
For developers and product customers
→ Quality and Productivity
A scripting language doesn't have to look like one