Introduction to Python
Tuesday, May 11, 2010 at 9:00 AM - Thursday, May 13, 2010 at 4:00 PM (EDT)
Python lets you get more programming done faster, and helps you integrate your systems more effectively. Existing programmers who learn to use Python see almost immediate gains in productivity and lower maintenance loads.
Steve Holden FBCS, CITP, MIEEE has taught computing technologies to a wide audience for more than twenty years. He has presented many well-received Python classes and talks to conferences around the world, and regularly teaches and consults with an international clientele. Steve is the chairman of the Python Software Foundation and the author of Python Web Programming. This hands-on class provides a sound basis for professional use of the Python language, presented with a blunt Yorkshire helping of software common sense.
The Python Language
The fundamentals of the language; line and statement structure; using the interactive interpreter; namespaces and data storage in Python; code readability.
Datatypes, Values and Literals
Names and assignemnt; understanding Python's assignment semantics; the numeric data types; sequence types, indexing and slicing; string literals; string methods; lists and tuples; the dict; sets and frozensets; files. The None type; unpacking assignment; assignment to container elements; slice assignment; augmented assignments.
Simple statements: pass, del, exec, print, raise, import. Compound statements: indentation and block structure; if, else, elif; for loops, while loops, continue and break; the else clause. Handling exceptions: try, except, else and finally. Running programs; testing: main program vs. imported modules.
Defining and Using Functions
The def statement; parameter specifications; calling a function; The return statement. Argument/parameter correspondence. Handling mutable defaults; variable argument counts. Nested functions and closures.
Modules and Packages
Importing a module; standard imports illustrated; importing under an alias. How modules are located: the role of sys.path; import semantics and namespace relationships; importing individual names. A brief description of packages.
I/O and Formatting
Opening a file; file modes; the abbreviated file API; file-like objects; a simple example. Format operations; format specification codes; simple formatting examples; a second file handling example.
Types and instances; representing data structures; attribute access to data; the simplest possible class definition; building an "object factory" function; separating creation and initialization. Instances are namespaces; classes are namespaces; namespace hierarchy; specifying behavior in classes; instance method calls and the self convention. The __init__() special method. Polymorphism, encapsulation and inheritance; a simple inheritance example.
More Advanced Topics
Regular expressions: when not to use them; basic pattern components; matching and searching; match objects. List comprehehnsions; generators - replacing containers with "values on demand". Python's iteration protocols; legacy iteration support; the new iteration protocol; implementing class-based iterators;generator expressions. Unit testing; test-driven development and the unittest module; a worked example.
Your Questions Answered
Your questions are encouraged to ensure full understanding of the material. You may bring your own laptop, or use our computer ready-loaded with all necessary Python modules and exercise code.
When & Where
The Open Bastion
The Open Bastion, a Holden Web subsidiary, produces open source events, training and conferences for an international audience.