Python Training for HP OSO

4/17/00


Click here to start


Table of Contents

Python Training for HP OSO

Plug

CODE STRUCTURE

The importance of readability

Writing readable code

Modifying existing code

Organizing code clearly

When to use classes (...and when not!)

Class hierarchies

Modules and packages

Naming conventions (my preferred style)

The main program

DOCUMENTATION

Writing comments

Writing doc strings

When NOT to use comments

One more thing...

THE LIBRARY

The library is your friend!

Stupid os.path tricks

PORTING YOUR BRAIN

Class or module?

Private, protected, public?

Method/constr. overloading

Java interfaces

Abstract classes

ERROR HANDLING

When to catch exceptions

When NOT to catch them

Exception handling style

Error reporting/logging

The danger of “except:”

PYTHON PITFALLS

Sharing mutable objects

Lurking bugs

Global variables

kjpylint

PERFORMANCE

When to worry about speed

Using the profile module

Measuring raw speed

How to hand-optimize code

When NOT to optimize code

THREAD PROGRAMMING

Which API?

Atomic operations

Python lock objects

Critical sections

"Synchronized" methods

Worker threads

Shared work queue

Using a list as a queue

Using a condition variable

TIME FOR DISCUSSION

Author: Guido van Rossum

Email: guido@python.org

Home Page: http://www.python.org/~guido/

Download presentation source