> it's not infeasible to add a close() method to
> generators as a shortcut for this:
>
> def close(self):
> try:
> self.__exit__(StopIteration)
> except StopIteration:
> break
> else:
> # __exit__() didn't
> raise RuntimeError("or some other exception")
>
> I'd like the block statement to be defined exclusively in terms of
> __exit__() though.
That sounds like a winner.
Raymond
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com