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

 

 

 


 

So What’s Python?

 

 

 

 

“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, .NET, Java, Soap, XML-RPC, Corba, …

Ø   Easy to use: 3x ~ 4x less code than Java, C++

 

 

 

 

Plus…

 

Ø   General purpose

Ø   Tactical or strategic

Ø   Stand alone or embedded

Ø   Very high-level, dynamic

 

 

 

 

Why Do People Use Python?

 

 

 

 

 

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

 

 

 

 

 

Some Quotable Quotes

 

 

 

¨   “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.”

 

 

 

A more formal definition?

Seen on comp.lang.python…

 

 

 

 

 

 

A Python History Lesson

 

 

 

 

¨   Created by Guido van Rossum in Amsterdam, 1990

¨     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, Europe, Asia, Australia

 

 

 

 

 

¨   Community: 750K to 1M users worldwide (guesstimate), user groups, two annual US conferences (PyCon, OSCON), European conferences (EuroPy, PythonUK)

 

 

 

 

¨   Named after 70s BBC comedy group “Monty Python's Flying Circus” (no, really)

 

 

Ø     On the significance of Spam…

 

 

 

 

Advocacy News

 

 

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, Los Alamos, NASA

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 .NET/Mono (Msoft),

Windows COM

Jython Java port

Zope & Plone web site frameworks

Mac OS X Cocoa integration

Sun’s Coyote project?

Cellphone ports

Compilers

IronPython (Microsoft), Python.net for C#/“.NET

Jython for Java

Standard C-Python

PyPy &  Psyco

Parrot

Group therapy

Python user groups: Oregon, Bay Area, DC, Colorado, Italy, England, Korea,…

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

 

 

 

 

What’s Python Good For?

 

 

 

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, MFC, X11, Swing (Jython)

 

¨  Internet scripting

CGI, email, FTP, Telnet, Jython applets, XML-RPC, SOAP, ActiveScripting, mod_Python (Apache)

 

¨   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,...

 

 

 

 

 

What’s Python Not Good For?

 

 

 

¨  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 JIT may improve the speed story

 

 

 

 

 

Embedding

 

Extending

 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 


Python Technical Features

 

 

¨  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

 

 

 

 

 

Python Portability

 

 

 

¨  Core Language + Standard Library

¨     Unix, Linux, Windows, Macs

¨     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

¨    

 

¨  Platform-specific Extensions

¨     COM on Windows (PyWin32 extension)

¨     Cocoa on the Mac (Standard component)

 

¨  General Portability

¨     Bytecode is platform-neutral

¨     Tkinter GUI library: X (Unix), Windows, Macs

¨     Standard library system calls (module “os”)

 

 

  

 

On Apples and Oranges

 

 

 

 

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

 

 

 

 

 

 

 


 

Summary: Why Python?

 

 

¨  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

 

 

 


 

 

 

 

 

 

 


A morality tale of Perl versus Python

 

(The following was posted recently to the rec.humor.funny USENET newsgroup, by Larry Hastings, and is reprinted here with the original author’s permission. I don’t necessarily condone language wars.)

 

This has been percolating in the back of my mind for a while. It's a scene from The Empire Strikes Back, reinterpreted to serve a valuable moral lesson for aspiring programmers.

 

EXTERIOR: DAGOBAH--DAY

With Yoda strapped to his back, Luke climbs up one of the many thick vines that grow in the swamp until he reaches the Dagobah statistics lab. Panting heavily, he continues his exercises--grepping, installing new packages, logging in as root, and writing replacements for two-year-old shell scripts in Python.

 

YODA:     Code!  Yes.  A programmer's strength flows from code

              maintainability.  But beware of Perl. Terse syntax... more

              than one way to do it... default variables.  The dark side of

              code maintainability are they.  Easily they flow, quick to join

              you when code you write.  If once you start down the dark

              path, forever will it dominate your destiny, consume you

              it will.

 

LUKE: Is Perl better than Python?

 

YODA:     No... no... no.  Quicker, easier, more seductive.

 

LUKE: But how will I know why Python is better than Perl?

 

YODA:     You will know.  When your code you try to read six

        months from now.