Python

From bbh wiki
Jump to navigationJump to search

General Python Info

python.org

Python documentation, including Guido's tutorial

Python Quick Reference (2.4)

Python Programming wikibook

How to Think Like a Computer Scientist, Learning with Python, 2nd Ed. by Jeffrey Elkner, Allen B. Downey and Chris Meyers

Python for Software Design: How to Think Like a Computer Scientist by Allen B. Downey HTML version of Think Python

Dive Into Python book

From Guido van Rossum's Python Tutorial: "By the way, the language is named after the BBC show Monty Python's Flying Circus and has nothing to do with nasty reptiles. Making references to Monty Python skits in documentation is not only allowed, it is encouraged!"

unittest

Python IDEs

Idle

IPython an improved interactive python shell.

Python Bibliotheca

Installing Idle on a Mac with Leopard (which already has Python 2.5.1)

One Laptop Per Child Python environment: The OLPC's user interface (Sugar) and many of its applications are written in Python.

Location of site-packages on a Debian-based system (like Ubuntu):

/usr/lib/python2.5/site-packages/

Python documentation is written in reStructuredText

Presentations from PyCon

Virtualenv and virtualenvwrapper

PEPs

Tools for Python Development

  • virtualenv for running python programs in isolated environment with a particular version of python and particular available packages.
  • sphinx a documentation generator. The official Python and Django documentation pages are done with Sphinx. The text is written in a stylized form of plain text known as ReStructuredText. See:A ReStructuredText Primer and Quick reStructuredText.
  • trac issue tracking and wiki. For configuration with WSGI: TracModWSGI
  • fabric "simple pythonic deployment"; deploying web applications to servers and automating other remote tasks. See the fabric tutorial.
  • pip python package installer

search path for loading modules

To see the current search path for loading modules:

import sys
sys.path

to set the path in the shell so that it is available for a regular python command window

BUT this does not work for IDLE.

To add to that path, set the environment variable PYTHONPATH, such as (with a bash shell):

export PYTHONPATH=/path/to/someplace/mydirectory/

or multiple directories separated by colons, and $HOME refers to the user's home directory:

export PYTHONPATH=/path/to/someplace/mydirectory/:$HOME/path/to/subdirectory/belowhome/

in the case where PYTHONPATH is already set and you just want to add to it:

export PYTHONPATH=${PYTHONPATH}:/path/to/someplace/mydirectory/

The new path can be seen by:

export

or to see just PYTHONPATH:

export | grep PYTHONPATH

inside IDLE or inside any python command window

sys.path is a list of strings

to add to the front:

import sys
sys.path.insert(0,"/path/to/wherever")

to add to the end:

sys.path.append("/path/to/wherever")

Other

Web Application Development