astropy/astropy — pull request #771 by mdboom (2013-02-13 16:57:44+00:00)
Title: Make generator version of ProgressBar

At the moment, the ``ProgressBar`` can be used as a context manager:

```
with ProgressBar(len(items)) as bar:
for item in enumerate(items):
bar.update()
```

but what about allowing it to be used as a generator, which could cut down on the code even more:

```
for item in ProgressBar(items):
```

which would take care of finding the length of ``items`` and calling ``update``? Maybe one could have a convenience method with a better name for this case, but just an idea :-)