- Mac OSX
- Binary installation from python.org
- Windows
- Binary installation from python.org
- Ubuntu/Debian
- sudo apt-get install python2.7
What version? 2.6/2.7/3.2
- Python Docs
- Python Tutorial
- The Hitchhiker's Guide to Python
- Read the Docs
- Cheat Sheet
- Python Style Guide
Audience experience with programming? python?
My level of experience.
- Why Python?
- Python was designed to be a middle layer between then shell and systems programming
- Fast prototyping/quick turn around/no compilation
- Interactive Interpreter
- Read/eval/print loop
Whitespace
- Writing and Running Scripts/Modules
using python binary:
python script.py python -i script.py
shebang + execution bit:
#!/usr/bin/env python chmod 755 script.py
importing modules
running modules:
python -m module
script boilerplate:
if __name__ == '__main__': main()
- Variables
- Case sensitive
- Variables are simply labels that reference objects.
- Pass by reference/value vs mutability
- Varibales do not have types, objects have types.
- Types are not coerced.
- Strict/Dynamic Typing
- Everything is done at runtime (late binding)
- Namespaces are basically dicts
Conditionals
Loops
- Functions
- Definition
- Calling
- First class
- lambda
- Builtin Types
- numeric
- int (different forms of literals)
- float
- complex
- bool
- strings
- str
- unicode
- collections
- list
- dict
- tuple
- set
- indexing and slicing notation
- comprehensions
- Builtin Functions
- dir/help
- len/min/max/sum
- range/enumerate
- locals/globals
- eval/input/raw_input
- repr/str/unicode
- philosophy/implementation of builtin functions vs methods
- shadowing
Package/Module/Statement/Expression
The standard library
Working with files?
- Classes/OOP
- new style classes vs old style
- class creation process
- methods are just functions
- self is passed implicitly, received explicitly
- __init__
- super()
- classmethod/staticmethod