Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Python Development with PyDev and Eclipse - Tutorial

Lars Vogel

Version 1.7

25.04.2011

Revision History
Revision 0.112.01.2009Lars Vogel
Created
Revision 0.2 - 1.7 31.01.2009 - 25.04.2011Lars Vogel
bug fixes and enhancements

Python, Pydev and Eclipse

This article describes how to write and debug Python programs with Eclipse

This article was developed on Eclipse 3.6 (Helios), Python 2.6.2 and PyDev version 1.6.2.


Table of Contents

1. Overview
1.1. What is Python
1.2. Block concept in Python- Indentation
1.3. About this tutorial
2. Installation
2.1. Python
2.2. Eclipse Python Plugin
2.3. Configuration of Eclipse
3. Your first Python program in Eclipse
4. Debugging
5. Programming in Python
5.1. Comments
5.2. Variables
5.3. Assertions
5.4. Methods / Functions in Python
5.5. Loops and if clauses
5.6. String manipulation
5.7. Concatenate strings and numbers
5.8. Lists
5.9. Processing files in Python
5.10. Splitting strings and comparing lists.
5.11. Writing Python Scripts in Unicode
5.12. Classes in Python
6. Google App Engine
7. Thank you
8. Questions and Discussion
9. Links and Literature

1. Overview

1.1. What is Python

Python is an interpreted programming language and claims to be a very effective programming language. Python was develop from Guido van Rossum. The name Python is based on the the TV show "Monty Python’s Flying Circus". During execution the Python source code is translated into byte-code which is then interpreted by the Python interpreter. Python source code can also run on the Java Virtual Machine, in this case you are using Jython.

Key features of Python are:

  • high-level data types, as for example extensible lists

  • statement grouping is done by indentation instead of brackets

  • variable or argument declaration is not necessary

  • supports for object-orientated, procedural and / or functional programming style

1.2. Block concept in Python- Indentation

Python follows a different way then other programming languages to identify blocks on related code. A block is identified by indentation. If you have an if statement and the next line is indented then it means that this indented block belongs to the if. The Python interpreter supports either spaces or tabs, e.g. you can not mix both. The most "pythonic" way is to use 4 spaces per indentation level.

1.3. About this tutorial

This tutorial will first explain how to install Python and the Python plugins for Eclipse. It will then create a small Python project to show the usage of the plugin. Afterwards the general constructs of Python are explained.