comparison methods for all nodes
comparison / hash methods for all nodes
removed some old cruft
fixed doctest for py3
replace cmp with sensible use of > < for py3 compat