Links to other sites
Other programming languages

Python - not just the name of CMU's Common Lisp compiler engine

Provided you use an advanced editor such as Emacs, Python is a pleasure to use. The flip-side is that without auto-indent, it can be difficult, introducing subtle errors as often seen by groups that uses a mix of several different editors.

The huge upside, however, is that everything you need is in one place. (If only the Lisp crowd would learn by this wonderful example...!)

www.python.org

...that's all you really need to know for getting started with Python!

They make it so easy, regardless of whether you're a long-time seasoned professional programmer or have never seen a programming language before.


Everything else on this page is redundant because they've covered it all on Python.org !!!


Learning Python

New to the language or even new to programming?

Start here: http://python.org/topics/learn/

If you're familiar with at least one programming language such as Perl, Java, C++, SmallTalk, Lisp, etc the only printed book you need to purchase is the O'Reilly pocket reference series Python book.

(ISBN 0-596-00189-4; $12)

Just make sure it covers Python version 2! (that is, avoid used editions, as they're probably for Python 1.5)

There are few caveats about the language that can be addressed for those transitioning from another language: Keep reading.

Laugh

It's named Python because of MONTY PYTHON, so expect silly examples to play upon "spam & eggs" and "comfy chair" jokes or even ones from "confuse a cat."

Dead parrot references, however, are usually avoided.

(Refer to Monty Python's Flying Circus if you were deprived of a proper education: www.MontyPython.com)

Use a programming editor with auto-indent!

Python is like Java or C++ but without curly braces { } and semicolons ;

How, then, does it determine scope?-- Via indentation and white space.

Emacs

Emacs is highly recommended for syntax highlighting, auto-indent and more.

Some handy keystrokes:

First, M-... denotes meta which is handled by the ALT key on Windows. So, M-t means ALT-t. (All Emacs documentation uses meta or the M- notation.)

Likewise, S-... is for Shift, and C-... is for Control.

These may be used in combination: e.g., M-S-s is ALT plus Shift plus "s" key to search using a Regular Expression pattern (whereas C-s starts plain text searching).

There's too much to explain here, such as 800 levels of UnDo.

vi & vim

Users familiar with Unix are probably comfortable with vi (or "vim" for Cygwin on Windows).

Enable auto-indent and syntax highlighting modes by typing:

	:set autoindent
	:syntax on

Or add this to your ~/.virc (or ~/.vimrc) file:

	set autoindent
	syntax on

You'll still have to add the customary four spaces to begin a new block, as vi lacks any native syntax recognition.

DrPython

For a straight-forward tool more like Wordpad but with syntax highlighting, get the DrPython programming editor for Windows: http://sourceforge.net/projects/drpython/

Unpack the Zip file contents under C:/Python24/ using its default folder name ("drpython-2.2.9").

Create a Windows Shortcut with target:

C:\Python24\pythonw.exe "C:\Python24\drpython-2.2.9\drpython.py"

DrPython requires wxPython libraries: http://wxPython.org/download.php#binaries

Install wxPython in its default location, C:\Python24\...

Note, however, that the default is to use Tab characters for auto-indented code rather than the customary four (4) spaces. Please change this immediately to avoid breaking other people's code.

Preserving syntax highlighting

If you must kill trees by printing your source code or simply wish to maintain a nice visual representation of your code, consider using py2html or HTMLize within Emacs.

Both are available by searching www.python.org.

The home page for py2html is http://www.peck.org.uk/p/python


Tutorials

Object Oriented programming
Avoiding Pitfalls
1.py 1.log 2.py 2.log diffs
Calling An External Program
Coding Style

Content on this page last updated 2006-05-13; URLs verified 2006-06-10

Site maintained by Daniel Pezely every now and then