Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code.

Python has dynamic types. Types are not declared; instead, they are associated with values assigned to variables. Variables are essentially names for values.

Python has strong types. There are no automatic type conversions other than common numerical promotions; adding a string to an integer, for example, is an error.

Classes and functions can be created, inspected and modified at runtime. Classes and functions are first class objects which can themselves be saved, passed to and returned from functions, and modified on-the-fly.

The run-time environment is extraordinarily transparent and customizable. For example it is possible to inspect the call stack or modify the way object attributes are accessed.

Python includes automatic garbage collection - no need to worry about allocation and deallocation of memory.

Object-oriented programming is a core capability of Python. Every object is an instance of a class, even "primitive" types such as numbers and strings. User-defined classes are easily created and used. The behaviour of class mechanisms can be changed by defining special methods and custom meta-classes.

Python programs can be simple, straight-line scripts; they can be structured with functions; they can be object-oriented or functional; or they can mix all of these styles as appropriate. Larger programs can easily be broken up into modules and packages for organization and reuse. This makes Python scale well from small one-time scripts to large, complex projects. With the support of the standard library and third-party packages, Python is suitable for

scripting and automation

web clients and servers

GUI applications

database access

scientific and numeric programming

and almost any other programming task other than operating system components and real-time systems.

Experienced programmers can quickly become familiar with the language by reading the standard tutorial. Many beginners' resources for both new and experienced programmers are available online, as is the extensive documentation.

The Python community is friendly, helpful and welcoming to beginners. The python-tutor mailing list (moderated by yours truly) is an excellent place to get help with beginner's questions. Some beginners say this list is Python's best feature!

comp.lang.python is another excellent resource, more advanced than python-tutor but still very newbie-friendly.

GNHLUG's own PySIG meets on the fourth Thursday of each month in Manchester, NH. Meetings generally include a question-and-answer session and one or two presentations plus milk and cookies.

This is perhaps the most important reason to learn Python. Python is sometimes called "executable pseudo-code". Many programmers find that Python "fits your brain"; I often find that it is easier to write correct Python code to describe an algorithm than to write informal pseudo-code. Python gets out of the way and lets you quickly write the code you need. Python includes an interactive interpreter which is very useful for exploratory and ad hoc programming.

Python encourages writing very clean, readable code. It doesn't hide important details, nor does it require you to clutter your code with unneeded syntax. It gives you the tools to get a job done simply and clearly, then gets out of the way and lets you get to work.

Python comes standard in many Linux distributions and Mac OS X and is sometimes included on Windows PCs. If you don't have it already, download the most recent release from http://www.python.org/download/ or use the package manager for your Linux distribution.

Python programs can be created in any text editor. Many editors provide syntax highlighting, code completion and folding and other Python-specific features. If you plan to write many Python programs you will want to investigate this. An extensive list of editors with Python support can be found at
http://wiki.python.org/moin/PythonEditors.

Python includes an interactive interpreter that is useful for exploration, learning and ad hoc programming. To start the interpreter, type python to a command prompt. You will see something like this (>>> is the interpreter prompt):

Built-in types include integer, long integer, float, complex, string, unicode, list, tuple, set and dictionary. There is no character type; strings of length 1 represent characters.

Strings and numbers behave pretty much the way you might expect. Python supports long integers up to available memory:

>>> 'a' + 'b'
'ab'
>>> 2**100
1267650600228229401496703205376L

Strings are instances of str and support many operations including extracting substrings, formatting, simple search, comparison and case conversion. (Regular expression search is also available.)

The unicode type represents a Unicode string. Many codecs are included that translate between Unicode and byte-oriented character encodings.

Python values are strongly typed; the only automatic promotions are between numeric types. String multiplication by an integer has a special meaning but addition of a string and an integer is an error:

Lists are heterogeneous arrays implemented as arrays of object references. They can contain any kind of object including sublists or other structures. Lists support a variety of subscripts for reading and writing:

Tuples are immutable lists - they can be created, but once created their contents cannot be changed.

One use of tuples is for tuple assignment. If the left side of an expression is a tuple of names and the right side of the expression is a sequence with the same number of elements, the elements are assigned to the names. For example:

Variables in Python are names for values, not containers for values. Programmers coming from C and similar languages will need a new mental model of variables and assignment. This can help: reset your brain.

Assignment creates a new name for a value, or binds a new value to an existing name. Assignment never copies a value, it just creates a new name for a value. This leads to aliasing which can confuse beginners:

Python supports if/elif/else and for and while loops with optional break and continue. Indentation defines the extent of a block; leading whitespace is significant. The required indentation is consistent with common formatting conventions in other languages. For example:

Python fully supports object-oriented programming. Actually, every Python value is an instance of a class, even numbers and strings:

>>> 1.0.__class__
<type 'float'>

In Python the self parameter (equivalent to this in other OO languages) is always explicit. It is the first parameter to a method. Special methods whose names start and end with two underscores implement and modify standard behaviour of the class; __init__() is the name of the constructor. Here is a simple class with two methods. It partially implements a stack using a Python list as the underlying data store:

Python objects are remarkably transparent. Introspection gives access to the attributes of every object. For example dir() shows interesting attributes of an object; getattr() and setattr() access attributes by name, and special attributes access the class of an object and the base classes of its class:

>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!