From: "Andrew Koenig" <ark@research.att.com>
David> Just replace 'names' by breadth_first and 'numbers' by depth_first.
David> or-vice-versa-ly y'rs,
which doesn't address the question of a uniform convention.
I'm with you on the desire to have a way to get a multipass-iterator-or-error in one swell foop. That says "I want to iterate over this thing without changing it". I still think that hasattr(iter(x), '__copy__') is a pretty clean way to do that, despite the fact that it potentially creates an iterator (which some people apparently view as too heavyweight as an introspection step). However, I don't see any point in trying to define a protocol for every different possible iteration view of a thing. Dicts have keys, values, and items. Trees have breadth-first, depth-first, inorder, postorder, blah, blah, blah. There are just too many of these, and they're all different. -Dave