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: 1222279182|%e %b %Y, %H:%M %Z (%O ago)