> Rather than iterator, I think we should add a visitor that calls a
function for each leaf exception,
I agree that we shouldn't add an `__iter__` method. But what if we added a separate method that returns an iterator? Then you could write
```
for e in eg.something():
print("caught", e)
```
This looks cleaner to me than having to write
```
def handler(e):
print("caught", e)
eg.something(handler)
```
(Does my bias against callback functions shine through? :-)
> plus a utility that returns the
traceback of a leaf exception
> (as a single list, copying frames from the tracebacks of ExceptionGroups so that it's not destructive.)
Hm, what would the arguments for that utility be? Since ExceptionGroups can be nested, if you pass in the root EG and the leaf exception, it would require a full tree search to find the nodes that have all the needed tracebacks.
Maybe the API for the iterator-returning method should be that it returns an iterator of (exception, list-of-tracebacks) pairs? Or maybe there should be two iterator-returning methods, one that yields just exceptions and one that yields such pairs, so that if you don't need the tracebacks we don't have to construct them. (Separate methods so the static type doesn't depend on the value of a flag.) If in the end we were to go for something with a handler callback we could do a similar thing.