Introduction to Python

Introduction to Programming Languages and Techniques



FULL PYTHON TUTORIAL

Last updated 9/1/2014

Full Python Tutorial

Developed by Guido van Rossum in the early 1990s Named after Monty Python Available on eniac Available for download from

2

Python

Interpreted language: work with an evaluator

for language expressions (like DrJava, but more flexible)

Dynamically typed: variables do not have a

predefined type

Rich, built-in collection types:

Lists Tuples Dictionaries (maps) Sets

Concise

3

Language features

Indentation instead of braces Several sequence types

Strings '...': made of characters, immutable Lists [...]: made of anything, mutable Tuples (...) : made of anything, immutable

Powerful subscripting (slicing) Functions are independent entities (not all

functions are methods)

Exceptions as in Java Simple object system Iterators (like Java) and generators

4

Why Python?

Good example of scripting language "Pythonic" style is very concise Powerful but unobtrusive object system

Every value is an object

Powerful collection and iteration

abstractions

Dynamic typing makes generics easy

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download