Side Effects
Sources of side-effects in Python
- internal
- module import (think not import safe modules)
- object attributes
- class variables (e.g. implementing singleton pattern preserving identity)
- global variables
- external
- keyboard input (e.g. raw_input, sys.stdin)
- console output (e.g. print, sys.stdout, sys.stderr)
- filesystem (e.g. open/file, functions from os module)
- databases
- sockets
- graphical display output
Examples to think about
- Borg design pattern
- dynamically changing class definitions, e.g. adding/replacing method definitions
Research material
page revision: 4, last edited: 24 Sep 2008 17:59